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
One note, however: your grammar is incorrect. Specifically, your precedence is incorrect. Subscripting should be the same precedence as call (and property access). You should replace:
Otherwise, an expression like f()[0] won't be valid. I would also change the thing inside the brackets to expression, like parentheses (most languages do so), but the choice is yours 😃.
Also, you duplicate the rule unnecessarily: in your assignment rule, you need just one bracket (the asterisk is redundant). Instead of:
I've read your article https://calebschoepp.com/blog/2020/adding-a-list-data-type-to-lox/. Nice 😃.
One note, however: your grammar is incorrect. Specifically, your precedence is incorrect. Subscripting should be the same precedence as call (and property access). You should replace:
With:
Otherwise, an expression like
f()[0]
won't be valid. I would also change the thing inside the brackets toexpression
, like parentheses (most languages do so), but the choice is yours 😃.Also, you duplicate the rule unnecessarily: in your
assignment
rule, you need just one bracket (the asterisk is redundant). Instead of:Do:
Because an expression like
a[0][0] = 0
can emit normally for thea[0]
, just the[0] = 0
at the end needs special handling.Yeah, designing a language is hard 😄. This is the reason I always look for "what other languages do", preferably their EBNF, when writing my own EBNF.
Disclaimer: I haven't read your code, just your EBNF syntax.
The text was updated successfully, but these errors were encountered: