Created
December 3, 2023 15:55
-
-
Save tinfoil-knight/88f1b7bdf84581c96beea50deb91a4da to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MediaExpr { | |
// Syntax Grammar | |
Main = Expression | |
Expression = LogicOr | |
LogicOr = LogicAnd ("or" LogicAnd)* | |
LogicAnd = Equality ("and" Equality)* | |
Equality = Comparison (("!=" | "==") Comparison)* | |
Comparison = Term ((">" | ">=" | "<" | "<=") Term)* | |
Term = Factor (("-" | "+") Factor)* | |
Factor = Exponent (("/" | "*" | "%") Exponent)* | |
Exponent = Unary ("^" Unary)* | |
Unary = ("!" | "-") Unary --unary | |
| Literal | |
Literal = "(" Expression ")" --parens | |
| bool | |
| number | |
| variable | |
// Lexical Grammar | |
bool = "true" | "false" | |
number = decimal | whole | |
decimal = digit* "." digit+ | |
whole = digit+ | |
variable = letter alnum* | |
/* | |
alnum (an alpha-numeric character) = letter | |
| digit | |
digit (a digit) = "0".."9" | |
letter (a letter) = lower | |
| upper | |
| unicodeLtmo | |
*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment