statement => expression* | return ; // initially only expressions and a final return is supported (not sure how to represent it)
return => "return" low_bin ";"? ;
expression => assignment | reassignment;
assignment => ("const" | "mut") IDENTIFIER ( "=" ) low_bin ";"? ;
reassignment => IDENTIFIER ( "=" | "/=" | "-=" | "+=" | "*=" | "&=" | "^=" | "|=" ) low_bin ";"? ;
low_bin => high_bin ( ( "-" | "+") high_bin )* ;
high_bin => TERMINAL ( ( "/" | "*" | "%" ) TERMINAL )* ;
TERMINAL => NUMBER | IDENTIFIER ;
NUMBER => DIGIT+ ( "." DIGIT+ )? ;
IDENTIFIER => < any ALPHA except "_" > ( ALPHA | DIGIT )* ;
Last active
May 12, 2022 02:06
-
-
Save coffeebe4code/ce30088570068f29121e69997ce6b3e8 to your computer and use it in GitHub Desktop.
My BNF so far
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment