Skip to content

Commit

Permalink
fix parser to accord with new syntax spec
Browse files Browse the repository at this point in the history
class cast of the form `(class Id) expr` has the same priority as unary and lower priority than var/indx selection and call
  • Loading branch information
paulzfm committed Nov 1, 2019
1 parent 730945c commit eacc811
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/antlr4/DecafParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,16 @@ lValue
expr
: lit # literal
| THIS # this
| '(' expr ')' # paren
| '(' CLASS id ')' expr # classCast
| READ_INTEGER '(' ')' # readInt
| READ_LINE '(' ')' # readLine
| NEW id '(' ')' # newClass
| NEW elemType=type '[' length=expr ']' # newArray
| INSTANCEOF '(' expr ',' id ')' # classTest
| '(' expr ')' # paren
| varSelOrCall # singlePath
| expr '.' varSelOrCall # path
| array=expr '[' index=expr ']' # indexSel
| '(' CLASS id ')' expr # classCast
| prefix=('-'|'!') expr # unary
| lhs=expr infix=('*'|'/'|'%') rhs=expr # binary
| lhs=expr infix=('+'|'-') rhs=expr # binary
Expand Down

0 comments on commit eacc811

Please sign in to comment.