-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I'ts happening! nitcc can do LALR(1) (by default) and LR(1). We also split the grammar.nit module into two by extracting a lrautomaton.nit module.
- Loading branch information
Showing
81 changed files
with
1,899 additions
and
1,007 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
c x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Grammar amb; | ||
Parser | ||
Ignored #10, #32; | ||
s = a | a 'x' ; | ||
a = b | b 'x' ; | ||
b = 'c' ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Grammar amb; | ||
Parser | ||
Ignored #10, #32; | ||
s = 'hello' | 'hello' ; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Grammar amb; | ||
Parser | ||
Ignored #10, #32; | ||
s = a | Empty ; | ||
a = b | Empty ; | ||
b = 'c' ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Grammar calc; | ||
Lexer | ||
n = ('0'..'9')+ ; | ||
Parser | ||
Ignored #10, #32; | ||
e | ||
= e '+' a | ||
| e '-' a | ||
; | ||
a = | ||
| '(' e ')' | ||
| n | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
i a i a e a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Grammar dangling; | ||
Parser | ||
Ignored #10, #32; | ||
ss = s*; | ||
s | ||
= 'i' s 'e' s | ||
| 'i' s | ||
| 'a' | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
i a i a e a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Grammar dangling; | ||
Parser | ||
Ignored #10, #32; | ||
ss = s*; | ||
|
||
s | ||
= 'a' | ||
| 'i' se 'e' s | ||
| 'i' s | ||
; | ||
se | ||
= 'a' | ||
| 'i' se 'e' se | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
a id | ||
a id end | ||
a a id end end | ||
a a id end | ||
a a id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Grammar dangling; | ||
Parser | ||
Ignored #10, #32; | ||
es = e*; | ||
e | ||
= 'a' e 'end' | ||
| 'a' e | ||
| 'id' | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ccdd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Grammar dragon; | ||
Parser | ||
Ignored #10, #32; | ||
s = c c ; | ||
c = 'c' c | 'd' ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if id then id | ||
if id then id end | ||
if if id then id then id end | ||
if id then if id then id end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Grammar oneliner; | ||
Lexer | ||
eol = #10 | #13 ; | ||
|
||
Parser | ||
Ignored #32; | ||
|
||
prog | ||
= stmts | ||
; | ||
stmt | ||
= if_block stmt_or_end | ||
| if_block stmt_else stmt_or_end | ||
| 'id' | ||
; | ||
if_block | ||
= 'if' n? stmt no 'then' | ||
; | ||
stmt_or_end | ||
= stmt 'end'? | ||
| n stmts no 'end' | ||
| no 'end' | ||
; | ||
stmt_else | ||
= stmt 'else' | ||
| n stmts no 'else' | ||
| 'else' | ||
; | ||
stmts | ||
= stmts n stmt | ||
| stmt | ||
; | ||
no = n?; | ||
n = eol+; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
Grammar oneliner; | ||
Lexer | ||
eol = #10 | #13 ; | ||
|
||
Parser | ||
Ignored #32; | ||
|
||
prog | ||
= stmts | ||
; | ||
stmt | ||
= if_block stmt_or_end | ||
| if_block stmt_else stmt_or_end | ||
| 'id' | ||
; | ||
stmt_with_else | ||
= if_block stmt_else stmt_or_end | ||
| 'id' | ||
; | ||
if_block | ||
= 'if' n? stmt no 'then' | ||
; | ||
stmt_or_end | ||
= stmt 'end'? | ||
| n stmts no 'end' | ||
| no 'end' | ||
; | ||
stmt_end | ||
= stmt 'else' | ||
| n stmts no 'else' | ||
| 'else' | ||
; | ||
stmts_with_else | ||
= stmts_with_else n stmt_with_else | ||
| stmt_with_else | ||
; | ||
stmts | ||
= stmts n stmt | ||
| stmt | ||
; | ||
no = n?; | ||
n = eol+; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
aa|aa* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Grammar regex; | ||
Parser | ||
Ignored #10, #32; | ||
e = a | e '|' e | e e | e '*' ; | ||
a = 'a' ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
aa|aa* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Grammar regex; | ||
Parser | ||
Ignored #10, #32; | ||
e | ||
= a | ||
Unary | ||
e '*' | ||
Left | ||
e e | ||
Left | ||
e '|' e | ||
; | ||
a = 'a' ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
aa|aa* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Grammar regex; | ||
Parser | ||
Ignored #10, #32; | ||
e = e '|' e2 | e2; | ||
e2 = e2 e3 | e3 ; | ||
e3 = e4 '*' | e4 ; | ||
e4 = 'a' ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
REDUCE/REDUCE Conflict on state 1 e for token Eof: | ||
REDUCE on item: e→ e·, Eof | ||
REDUCE on item: e→ e·, Eof | ||
SHIFT/REDUCE Conflict on state 1 e for token Eof: | ||
SHIFT on item: _start→ e·Eof | ||
REDUCE on item: e→ e·, Eof | ||
Error: there is conflicts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
REDUCE/REDUCE Conflict on state 7 '-' e for token '+': | ||
REDUCE on item: a→ e·, Eof/'+' | ||
REDUCE on item: b→ e·, '+' | ||
Error: there is conflicts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
SHIFT/REDUCE Conflict on state 3 'a' for token 'b': | ||
SHIFT on item: x→·'b', Eof | ||
REDUCE on item: x→ 'a'·, 'b' | ||
Error: there is conflicts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Start | ||
s_0 | ||
a_1 | ||
b | ||
'c'@(1:1-1:2) | ||
'x'@(1:3-1:4) | ||
Eof@(2:1-2:1)='' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
SHIFT/REDUCE Conflict on state 3 b for token 'x': | ||
SHIFT on item: a→ b·'x', Eof/'x' | ||
REDUCE on item: a→ b·, Eof/'x' | ||
Error: there is conflicts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Start | ||
s_0 | ||
'hello'@(1:1-1:6) | ||
Eof@(2:1-2:1)='' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
REDUCE/REDUCE Conflict on state 2 'hello' for token Eof: | ||
REDUCE on item: s→ 'hello'·, Eof | ||
REDUCE on item: s→ 'hello'·, Eof | ||
Error: there is conflicts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Start | ||
s_0 | ||
a_1 | ||
Eof@(1:1-1:1)='' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
REDUCE/REDUCE Conflict on state 0 for token Eof: | ||
REDUCE on item: a→·, Eof | ||
REDUCE on item: s→·, Eof | ||
Error: there is conflicts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Automatic Dangling SHIFT/REDUCE on state 8 e '+' e for token '+': | ||
reduce: e→ e '+' e·, Eof/'+'/'*'/')' | ||
shift: e→ e·'+' e | ||
Automatic Dangling SHIFT/REDUCE on state 8 e '+' e for token '*': | ||
reduce: e→ e '+' e·, Eof/'+'/'*'/')' | ||
shift: e→ e·'*' e | ||
Automatic Dangling SHIFT/REDUCE on state 9 e '*' e for token '+': | ||
reduce: e→ e '*' e·, '+'/'*'/Eof/')' | ||
shift: e→ e·'+' e | ||
Automatic Dangling SHIFT/REDUCE on state 9 e '*' e for token '*': | ||
reduce: e→ e '*' e·, '+'/'*'/Eof/')' | ||
shift: e→ e·'*' e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Runtime error: Aborted (./lrautomaton.nit:507) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
SHIFT/REDUCE Conflict on state 8 '[' e '[' for token '[': | ||
SHIFT on item: e→·'[' e '[', ']'/'[' | ||
REDUCE on item: e→ '[' e '['·, Eof/'['/']' | ||
Error: there is conflicts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
SHIFT/REDUCE Conflict on state 7 '1' e for token '2': | ||
SHIFT on item: x→·'2', Eof/'2' | ||
REDUCE on item: e→ '1' e·, Eof/'2' | ||
Error: there is conflicts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
SHIFT/REDUCE Conflict on state 7 '1' e for token '2': | ||
SHIFT on item: x→·'2', Eof/'2' | ||
REDUCE on item: y→·, Eof/'2' | ||
Error: there is conflicts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
SHIFT/REDUCE Conflict on state 7 '1' e for token '2': | ||
SHIFT on item: e→ '1' e·'2', Eof/'2' | ||
REDUCE on item: e→ '1' e·, Eof/'2' | ||
Error: there is conflicts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Automatic Dangling SHIFT/REDUCE on state 6 '1' e for token '2': | ||
reduce: e→ '1' e·, Eof/'2' | ||
shift: x→·'2' | ||
core shift: e→ '1' e·x, Eof/'2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Automatic Dangling SHIFT/REDUCE on state 6 '1' e for token '2': | ||
reduce: y→·, Eof/'2' | ||
shift: x→·'2' | ||
core shift: y→·x, Eof/'2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Automatic Dangling SHIFT/REDUCE on state 6 '1' e for token '2': | ||
reduce: e→ '1' e·, Eof/'2' | ||
shift: e→ '1' e·'2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Start | ||
ss | ||
Nodes[Ns] | ||
s_1 | ||
'i'@(1:1-1:2) | ||
s_2 | ||
'a'@(1:3-1:4) | ||
s_0 | ||
'i'@(1:5-1:6) | ||
s_2 | ||
'a'@(1:7-1:8) | ||
'e'@(1:9-1:10) | ||
s_2 | ||
'a'@(1:11-1:12) | ||
Eof@(2:1-2:1)='' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Automatic Dangling SHIFT/REDUCE on state 8 'i' s for token 'e': | ||
reduce: s→ 'i' s·, Eof/'i'/'a'/'e' | ||
shift: s→ 'i' s·'e' s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Start | ||
ss | ||
Nodes[Ns] | ||
s_2 | ||
'i'@(1:1-1:2) | ||
s_0 | ||
'a'@(1:3-1:4) | ||
s_1 | ||
'i'@(1:5-1:6) | ||
se_0 | ||
'a'@(1:7-1:8) | ||
'e'@(1:9-1:10) | ||
s_0 | ||
'a'@(1:11-1:12) | ||
Eof@(2:1-2:1)='' |
Oops, something went wrong.