-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
From my understanding of http://textmapper.org/documentation.html#grammar-ambiguities, %shift modifiers may be used to resolve shift/reduce ambiguities in grammars.
From the example, I tried to derive a minimal working grammar. However, when I tried to generate the parser using Textmapper, I got the following error:
$ textmapper shiftreduce.tm
shiftreduce.tm,34: input: 'if' '(' Expr ')' Stmt
shift/reduce conflict (next: 'else')
IfStmt : 'if' '(' Expr ')' Stmt
conflicts: 1 shift/reduce and 0 reduce/reduce
lalr: 0.019s, text: 0.105s, parser: 18 states, 0KB
IfStmt
: 'if' '(' Expr ')' Stmt %shift 'else'
| 'if' '(' Expr ')' Stmt 'else' Stmt
;Is that the correct syntax for using %shift modifiers, and if so, why is there a shift/reduce error being reported?
If I remove 'if' '(' Expr ')' Stmt %shift 'else' from the grammar, Textmapper is able to successfully produce both lexers and parsers.
Edit: this is on version v0.9.22 of Textmapper.
u@x1 ~> textmapper --version
textmapper v0.9.22/java build 2018
yanok
Metadata
Metadata
Assignees
Labels
No labels