Skip to content

Commit eacc811

Browse files
committed
fix parser to accord with new syntax spec
class cast of the form `(class Id) expr` has the same priority as unary and lower priority than var/indx selection and call
1 parent 730945c commit eacc811

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/antlr4/DecafParser.g4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,16 @@ lValue
8383
expr
8484
: lit # literal
8585
| THIS # this
86-
| '(' expr ')' # paren
87-
| '(' CLASS id ')' expr # classCast
8886
| READ_INTEGER '(' ')' # readInt
8987
| READ_LINE '(' ')' # readLine
9088
| NEW id '(' ')' # newClass
9189
| NEW elemType=type '[' length=expr ']' # newArray
9290
| INSTANCEOF '(' expr ',' id ')' # classTest
91+
| '(' expr ')' # paren
9392
| varSelOrCall # singlePath
9493
| expr '.' varSelOrCall # path
9594
| array=expr '[' index=expr ']' # indexSel
95+
| '(' CLASS id ')' expr # classCast
9696
| prefix=('-'|'!') expr # unary
9797
| lhs=expr infix=('*'|'/'|'%') rhs=expr # binary
9898
| lhs=expr infix=('+'|'-') rhs=expr # binary

0 commit comments

Comments
 (0)