Skip to content

Commit 5ad8b55

Browse files
authored
Merge pull request #307 from Typee-Language/dev
Dev -> master
2 parents adf61fe + 8d562b6 commit 5ad8b55

22 files changed

+736
-191
lines changed

.pydevproject

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property>
55
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
66
<path>/${PROJECT_DIR_NAME}</path>
7+
<path>/${PROJECT_DIR_NAME}/src</path>
78
</pydev_pathproperty>
89
</pydev_project>
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: 53 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,28 @@ put here.
66

77
## Versionning
88

9+
### Since 2021
10+
11+
The Typee language grammar is specified according to the formal, unambiguous
12+
and easy to read PEG format (stands for *Processing Expression Grammar*).
13+
14+
Processing Expression Grammars have been first specified by Bryan Ford (MIT)
15+
by 2004 in his famous paper "Parsing Expression Grammars: A Recognition-Based
16+
Syntactic Foundation". This article has been published at the POPL’04
17+
conference that had been held by January 14–16, 2004 at Venice, Italy. Its a
18+
copyrighted document of ACM with number 1-58113-729-X/04/0001 and it can be
19+
easily found on the Net.
20+
21+
So, now on, all versions of Typee grammar specifications are numbered and
22+
named as `typee_specs_PEG_v<XX>.grm`, where `<XX>` belongs in
23+
interval 01 up to 99.
24+
25+
26+
### Before 2021
27+
28+
Notice that Typee language wass specified with a formal, unambiguous, LL(1)
29+
grammar.
30+
931
The very first version of these specifications is not numbered. See file
1032
`typee_specs_LL1.grm`.
1133

@@ -14,18 +36,39 @@ Next versions are all numbered: `...-v2.grm`, `...-v3.grm`, ...,
1436
document.
1537

1638
You'll notice that version `v4` is missing. Unfortunately, it has been lost
17-
before being stored here...
39+
before being stored here.
1840

19-
Finally, since version `v8`, a second version of the specifications is
41+
Since version `v8`, a second version of the specifications is
2042
provided: from `...-v8-EBNF.grm` to `...-v10-EBNF.grm`.
2143

22-
Notice that Typee language is specified with a formal, unambiguous, LL(1)
23-
grammar.
2444

2545

2646
## Specification format
2747

28-
### Formal classical description
48+
### Since 2021
49+
50+
The used syntax to describe the grammar rules is the original PEG one. So,
51+
we use notations `<-` and `/` for instance, while newer papers use `::=`
52+
or `|` instead as it is usual in CFGs (*Context Free Grammars*, which what
53+
LL(1) grammars are).
54+
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+
61+
We strongly encourage the reader to get access to the initial article from
62+
Bryan Ford. Section 2 of this paper fully explains the syntax of PEGrammars:
63+
"*Parsing Expression Grammars: A Recognition-Based Syntactic Foundation*",
64+
ACM 1-58113-729-X/04/0001, POPL’04, January 14–16, 2004, Venice, Italy. It
65+
can easily be accessed on Internet with these references. We shall not copy
66+
here anything from it without permission.
67+
68+
69+
### Before 2021
70+
71+
#### Formal classical description - LL(1)
2972

3073
The used syntax to describe the grammar rules is very classical.
3174
Rules are named between angle brackets: `<rule name>`. Those names may
@@ -67,7 +110,7 @@ group together successive rule names between parenthesis. Next specifications
67110
are unambiguous:
68111

69112
<single string> ::= "'" <single string'> "'"
70-
| '"' <ingle string"> '"'
113+
| '"' <single string"> '"'
71114

72115
<single string'> ::= <any escaped char> <single string'>
73116
| <any string quote char> <single string'>
@@ -82,7 +125,7 @@ this rule may be not derived. In the above rules, it states that empty strings
82125
formed as `''` or `""` are legal in Typee.
83126

84127

85-
### Extended Backus-Naur Form (EBNF) description
128+
#### Extended Backus-Naur Form (EBNF) description
86129

87130
This is a simplified and more easy to read format for grammar rules
88131
specifications. We have been providing them since version `v8` of Typee
@@ -106,12 +149,12 @@ underscore, i.e. `'_'`, preceding any series of alphanumerical character and
106149
undercores, i.e. any character from group `['0'...'9', 'A'...'Z', 'a'...'z', '_']`.
107150

108151
Parenthesis are also used jointly with an ending character star `'*'`. There,
109-
they men that the derivations rules the group together may be derived from 0
110-
to many times (with no limitations):
152+
they mean that the derivations rules that they group together may be derived
153+
from 0 to many times (with no limitations):
111154

112155
<identifier> ::= ( <alpha char> | '_' ) ( <alpha num char> | '_' )*
113156

114-
You can get here that this kind of factorization helps easying the reading of
157+
You can get here that this kind of factorization helps easing the reading of
115158
grammars specifications as well as it helps reducing their specifications
116159
sizes.
117160

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)