Skip to content

Commit 8d562b6

Browse files
authored
Merge pull request #306 from Typee-Language/#290-Specify-PEG-Typee-grammar
#290 specify peg typee grammar
2 parents 5a13fac + d4401b4 commit 8d562b6

File tree

5 files changed

+676
-169
lines changed

5 files changed

+676
-169
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<NotepadPlus>
2+
<UserLang name="PEGrammars" ext="peg" udlVersion="2.1">
3+
<Settings>
4+
<Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
5+
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
6+
</Settings>
7+
<KeywordLists>
8+
<Keywords name="Comments">00## 01 02 03 04</Keywords>
9+
<Keywords name="Numbers, prefix1"></Keywords>
10+
<Keywords name="Numbers, prefix2"></Keywords>
11+
<Keywords name="Numbers, extras1"></Keywords>
12+
<Keywords name="Numbers, extras2"></Keywords>
13+
<Keywords name="Numbers, suffix1"></Keywords>
14+
<Keywords name="Numbers, suffix2"></Keywords>
15+
<Keywords name="Numbers, range"></Keywords>
16+
<Keywords name="Operators1">? * + &amp; ! ( ) . [ ]</Keywords>
17+
<Keywords name="Operators2"></Keywords>
18+
<Keywords name="Folders in code1, open"></Keywords>
19+
<Keywords name="Folders in code1, middle"></Keywords>
20+
<Keywords name="Folders in code1, close"></Keywords>
21+
<Keywords name="Folders in code2, open"></Keywords>
22+
<Keywords name="Folders in code2, middle"></Keywords>
23+
<Keywords name="Folders in code2, close"></Keywords>
24+
<Keywords name="Folders in comment, open"></Keywords>
25+
<Keywords name="Folders in comment, middle"></Keywords>
26+
<Keywords name="Folders in comment, close"></Keywords>
27+
<Keywords name="Keywords1">&lt;- /</Keywords>
28+
<Keywords name="Keywords2"></Keywords>
29+
<Keywords name="Keywords3"></Keywords>
30+
<Keywords name="Keywords4"></Keywords>
31+
<Keywords name="Keywords5"></Keywords>
32+
<Keywords name="Keywords6"></Keywords>
33+
<Keywords name="Keywords7"></Keywords>
34+
<Keywords name="Keywords8"></Keywords>
35+
<Keywords name="Delimiters">00&quot; 01 02&quot; 03&apos; 04 05&apos; 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>
36+
</KeywordLists>
37+
<Styles>
38+
<WordsStyle name="DEFAULT" fgColor="000000" bgColor="FFFFFF" fontName="Consolas" fontStyle="0" fontSize="9" nesting="0" />
39+
<WordsStyle name="COMMENTS" fgColor="00A0A0" bgColor="FFFF46" fontName="" fontStyle="3" nesting="0" />
40+
<WordsStyle name="LINE COMMENTS" fgColor="626262" bgColor="FFFF46" fontName="" fontStyle="2" nesting="0" />
41+
<WordsStyle name="NUMBERS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
42+
<WordsStyle name="KEYWORDS1" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
43+
<WordsStyle name="KEYWORDS2" fgColor="008040" bgColor="FFFFFF" fontName="" fontStyle="3" nesting="0" />
44+
<WordsStyle name="KEYWORDS3" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
45+
<WordsStyle name="KEYWORDS4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
46+
<WordsStyle name="KEYWORDS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
47+
<WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
48+
<WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
49+
<WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
50+
<WordsStyle name="OPERATORS" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
51+
<WordsStyle name="FOLDER IN CODE1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
52+
<WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
53+
<WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontName="Consolas" fontStyle="0" fontSize="9" nesting="0" />
54+
<WordsStyle name="DELIMITERS1" fgColor="C86400" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
55+
<WordsStyle name="DELIMITERS2" fgColor="C86400" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
56+
<WordsStyle name="DELIMITERS3" fgColor="0000A0" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
57+
<WordsStyle name="DELIMITERS4" fgColor="0000A0" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
58+
<WordsStyle name="DELIMITERS5" fgColor="004040" bgColor="00FFFF" fontName="" fontStyle="0" nesting="0" />
59+
<WordsStyle name="DELIMITERS6" fgColor="0000A0" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
60+
<WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
61+
<WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
62+
</Styles>
63+
</UserLang>
64+
</NotepadPlus>

Language-specifications/ReadMe.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ copyrighted document of ACM with number 1-58113-729-X/04/0001 and it can be
1919
easily found on the Net.
2020

2121
So, now on, all versions of Typee grammar specifications are numbered and
22-
named as `typee_sppecs_PEG_v<XX>.grm`, where `<XX>` belongs in
22+
named as `typee_specs_PEG_v<XX>.grm`, where `<XX>` belongs in
2323
interval 01 up to 99.
2424

2525

@@ -52,6 +52,12 @@ we use notations `<-` and `/` for instance, while newer papers use `::=`
5252
or `|` instead as it is usual in CFGs (*Context Free Grammars*, which what
5353
LL(1) grammars are).
5454

55+
Notice that we use notation '##' as the starting point for comments, while
56+
Bryan Floyd was using '#' in his original paper. This is a commodity we use
57+
to get colored syntax in Notepad++. Notice also that Comments are one line
58+
comments only in the very first description of PEG grammars. The PEG
59+
specification of **Typee** conforms to this.
60+
5561
We strongly encourage the reader to get access to the initial article from
5662
Bryan Ford. Section 2 of this paper fully explains the syntax of PEGrammars:
5763
"*Parsing Expression Grammars: A Recognition-Based Syntactic Foundation*",

Language-specifications/typee_specs_LL1-v10.grm

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,10 @@ SOFTWARE.
878878
| EPS
879879

880880

881+
<scalar type or dotted name> ::= <scalar type>
882+
| <dotted name>
883+
884+
881885

882886

883887
/***** TYPES ****************************************************/
@@ -892,6 +896,7 @@ SOFTWARE.
892896
<type'> ::= <auto type>
893897
| '(' <types list> ')'
894898
| <container type>
899+
| <enum type>
895900
| <file type>
896901
| <NONE>
897902
| <scalar type> <dimensions>
@@ -909,7 +914,6 @@ SOFTWARE.
909914
| EPS
910915

911916
<container type> ::= <array_type>
912-
| <enum type>
913917
| <list type>
914918
| <map type>
915919
| <set type>
@@ -920,6 +924,7 @@ SOFTWARE.
920924
| EPS
921925
<dimensions'> ::= <integer number>
922926
| <dotted name>
927+
923928
<enum type> ::= 'enum'
924929

925930
<file type> ::= 'file' <contained type>
@@ -956,10 +961,6 @@ SOFTWARE.
956961
| 'uint32'
957962
| 'uint64'
958963

959-
<scalar type or dotted name> ::= <scalar type>
960-
| <dotted name>
961-
962-
963964
<set type> ::= 'set' <contained type>
964965

965966
<static qualifier> ::= 'static'

0 commit comments

Comments
 (0)