-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nitcc: add examples in case of conflicts #2842
Add example of possible prefix (past) and suffix (future) in case of conflict shift/reduce or reduce/reduce. Example: ``` SHIFT/REDUCE Conflict on state 3 'a' for token 'b': A possible past: ['a'] SHIFT on item: x::x_1=.'b' A possible future: ['b',Eof] _start ├╴e │ ├╴'a' │ └╴x │ └╴'b' └╴Eof REDUCE on item: x::x_0= 'a'. A possible future: ['b',Eof] _start ├╴e │ ├╴x │ │ └╴'a' │ └╴'b' └╴Eof AMBIGUITY detected: same elements, different trees ``` This should help the user to contextualize some conflicts and enable them to fix their grammar.
- Loading branch information
Showing
43 changed files
with
605 additions
and
42 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
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,4 @@ | ||
Grammar amb; | ||
Parser | ||
Ignored #10, #32; | ||
e = 'id' | 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 @@ | ||
-0+ |
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; | ||
e = '-' a | b '+' | '0'; | ||
a = e ; | ||
b = 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 @@ | ||
a b |
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 amb; | ||
Parser | ||
Ignored #10, #32; | ||
e = x 'b' | 'a' x ; | ||
x = 'a' | 'b'; |
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 @@ | ||
1+2+3*(4+5) |
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,11 @@ | ||
Grammar calc; | ||
Lexer | ||
n = ('0'..'9')+ ; | ||
Parser | ||
Ignored #10, #32; | ||
e | ||
= e '+' e | ||
| e '*' e | ||
| '(' 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 @@ | ||
id=id=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 eq; | ||
Parser | ||
Ignored #10, #32; | ||
e = | ||
var '=' e | | ||
var ; | ||
c = | ||
e '=' e ; | ||
var = '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 @@ | ||
id=id=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,10 @@ | ||
Grammar eq; | ||
Parser | ||
Ignored #10, #32; | ||
e = | ||
var '=' e | | ||
'assert' c | | ||
var ; | ||
c = | ||
e '=' e ; | ||
var = '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 @@ | ||
id=id=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,10 @@ | ||
Grammar eq; | ||
Parser | ||
Ignored #10, #32; | ||
e = | ||
var '=' e | | ||
c | | ||
var ; | ||
c = | ||
e '=' e ; | ||
var = '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 @@ | ||
triangle 0x0 0@0 centre circle 0x0 0@0 |
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,8 @@ | ||
Grammar geom; | ||
Parser | ||
Ignored #10, #32; | ||
forme = | ||
'triangle' point point point | | ||
'circle' point point ; | ||
point = num 'x' num | num '@' num | 'centre' forme; | ||
num = '0'; |
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 @@ | ||
<0><0>> |
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 @@ | ||
<0><0>0 |
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 lg; | ||
Parser | ||
Ignored #10, #32; | ||
e = e '<' a | e '>' a | a ; | ||
a = n | '<' e '>' ; | ||
n = '0' ; |
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 @@ | ||
<0><0>> |
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 @@ | ||
<0><0>0 |
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 lg; | ||
Parser | ||
Ignored #10, #32; | ||
e = e '<' e | e '>' e | n | '<' e '>' ; | ||
n = '0' ; |
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 | ||
e_0 | ||
'id'@(1:1-1:3) | ||
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 @@ | ||
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,10 @@ | ||
Start | ||
e_1 | ||
b | ||
e_0 | ||
'-'@(1:1-1:2) | ||
a | ||
e_2 | ||
'0'@(1:2-1:3) | ||
'+'@(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 @@ | ||
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,6 @@ | ||
Start | ||
e_1 | ||
'a'@(1:1-1:2) | ||
x_1 | ||
'b'@(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 @@ | ||
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,23 @@ | ||
Start | ||
e_0 | ||
e_3 | ||
n@(1:1-1:2)='1' | ||
'+'@(1:2-1:3) | ||
e_0 | ||
e_3 | ||
n@(1:3-1:4)='2' | ||
'+'@(1:4-1:5) | ||
e_1 | ||
e_3 | ||
n@(1:5-1:6)='3' | ||
'*'@(1:6-1:7) | ||
e_2 | ||
'('@(1:7-1:8) | ||
e_0 | ||
e_3 | ||
n@(1:8-1:9)='4' | ||
'+'@(1:9-1:10) | ||
e_3 | ||
n@(1:10-1:11)='5' | ||
')'@(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,13 @@ | ||
Start | ||
e_0 | ||
var | ||
'id'@(1:1-1:3) | ||
'='@(1:3-1:4) | ||
e_0 | ||
var | ||
'id'@(1:4-1:6) | ||
'='@(1:6-1:7) | ||
e_1 | ||
var | ||
'id'@(1:7-1:9) | ||
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 @@ | ||
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,13 @@ | ||
Start | ||
e_0 | ||
var | ||
'id'@(1:1-1:3) | ||
'='@(1:3-1:4) | ||
e_0 | ||
var | ||
'id'@(1:4-1:6) | ||
'='@(1:6-1:7) | ||
e_2 | ||
var | ||
'id'@(1:7-1:9) | ||
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 @@ | ||
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,13 @@ | ||
Start | ||
e_0 | ||
var | ||
'id'@(1:1-1:3) | ||
'='@(1:3-1:4) | ||
e_0 | ||
var | ||
'id'@(1:4-1:6) | ||
'='@(1:6-1:7) | ||
e_2 | ||
var | ||
'id'@(1:7-1:9) | ||
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 @@ | ||
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,32 @@ | ||
Start | ||
forme_0 | ||
'triangle'@(1:1-1:9) | ||
point_0 | ||
num | ||
'0'@(1:10-1:11) | ||
'x'@(1:11-1:12) | ||
num | ||
'0'@(1:12-1:13) | ||
point_1 | ||
num | ||
'0'@(1:14-1:15) | ||
'@'@(1:15-1:16) | ||
num | ||
'0'@(1:16-1:17) | ||
point_2 | ||
'centre'@(1:18-1:24) | ||
forme_1 | ||
'circle'@(1:25-1:31) | ||
point_0 | ||
num | ||
'0'@(1:32-1:33) | ||
'x'@(1:33-1:34) | ||
num | ||
'0'@(1:34-1:35) | ||
point_1 | ||
num | ||
'0'@(1:36-1:37) | ||
'@'@(1:37-1:38) | ||
num | ||
'0'@(1:38-1:39) | ||
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,19 @@ | ||
Start | ||
e_2 | ||
a_1 | ||
'<'@(1:1-1:2) | ||
e_1 | ||
e_2 | ||
a_0 | ||
n | ||
'0'@(1:2-1:3) | ||
'>'@(1:3-1:4) | ||
a_1 | ||
'<'@(1:4-1:5) | ||
e_2 | ||
a_0 | ||
n | ||
'0'@(1:5-1:6) | ||
'>'@(1:6-1:7) | ||
'>'@(1:7-1:8) | ||
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,19 @@ | ||
NParserError@(2:1-2:1)='' | ||
Nodes[Node] | ||
'<'@(1:1-1:2) | ||
e_2 | ||
a_0 | ||
n | ||
'0'@(1:2-1:3) | ||
'>'@(1:3-1:4) | ||
'<'@(1:4-1:5) | ||
e_1 | ||
e_2 | ||
a_0 | ||
n | ||
'0'@(1:5-1:6) | ||
'>'@(1:6-1:7) | ||
a_0 | ||
n | ||
'0'@(1:7-1:8) | ||
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 @@ | ||
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,15 @@ | ||
NParserError@(2:1-2:1)='' | ||
Nodes[Node] | ||
'<'@(1:1-1:2) | ||
e_2 | ||
n | ||
'0'@(1:2-1:3) | ||
'>'@(1:3-1:4) | ||
e_3 | ||
'<'@(1:4-1:5) | ||
e_2 | ||
n | ||
'0'@(1:5-1:6) | ||
'>'@(1:6-1:7) | ||
'>'@(1:7-1:8) | ||
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,17 @@ | ||
NParserError@(2:1-2:1)='' | ||
Nodes[Node] | ||
'<'@(1:1-1:2) | ||
e_2 | ||
n | ||
'0'@(1:2-1:3) | ||
'>'@(1:3-1:4) | ||
'<'@(1:4-1:5) | ||
e_1 | ||
e_2 | ||
n | ||
'0'@(1:5-1:6) | ||
'>'@(1:6-1:7) | ||
e_2 | ||
n | ||
'0'@(1:7-1:8) | ||
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 @@ | ||
Error: there is conflicts |