You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why doesn't clox support non-synchronizing errors for its compiler? This alters error reporting quite a bit in some cases.
Take this input in exam: if (1 = 1) { print 1; }
jlox parses the whole assignment, then reports [line 1] Error at '=': Invalid assignment target., then calls statement() to parse the then-branch and doesn't find any more errors.
clox does this:
consumes "if 1 =", reports [line 1] Error at '=': Invalid assignment target. and enables panic mode
expects a ')' but finds the second '1' so it triggers a silent error
tries to parse the then-branch as an expression statement starting with "1) ..."
consumes '1' but finds ')' instead of ';' so it triggers a silent error
starts synchronization
consumes up to "print" exluded
flawlessly parses "print 1;"
tries to parse the expression statement starting with '}'
reports [line 1] Error at '}': Expect expression.
tl;dr: skips to print... and signals unopened block
Is this design intended for simplicity? Am I missing something?
The text was updated successfully, but these errors were encountered:
Why doesn't clox support non-synchronizing errors for its compiler? This alters error reporting quite a bit in some cases.
Take this input in exam:
if (1 = 1) { print 1; }
jlox parses the whole assignment, then reports
[line 1] Error at '=': Invalid assignment target.
, then callsstatement()
to parse the then-branch and doesn't find any more errors.clox does this:
[line 1] Error at '=': Invalid assignment target.
and enables panic mode[line 1] Error at '}': Expect expression.
print...
and signals unopened blockIs this design intended for simplicity? Am I missing something?
The text was updated successfully, but these errors were encountered: