ccm/doc/grammar.bnf

24 lines
461 B
BNF
Raw Normal View History

2024-03-18 17:20:40 +00:00
MODULE ::= EXPR*
EXPR ::=
| IN
2024-03-18 17:20:40 +00:00
| ASSERT
ASSERT ::= (assert_eq|assert_ne) tuple
IN ::= OR (in OR)?
2024-03-19 06:11:28 +00:00
OR ::= AND (or AND)*
AND ::= TERM (and TERM)*
2024-03-18 17:20:40 +00:00
TERM ::= FACTOR ((add|sub) FACTOR)*
FACTOR ::= USUB ((mul|div|mod) USUB)*
2024-03-19 06:11:28 +00:00
USUB ::= sub* NOT
NOT ::= not* POW
2024-03-18 17:20:40 +00:00
POW ::= LITERAL (pow LITERAL)?
LITERAL ::=
| BUILTIN
| TUPLE
| INDEX
2024-03-18 17:20:40 +00:00
| opar EXPR cpar
INDEX ::=
2024-03-19 13:23:11 +00:00
| (TUPLE|str) osquare (EXPR (comma EXPR)*)? csquare
2024-03-18 17:20:40 +00:00
TUPLE ::=
| opar EXPR+ cpar
2024-03-19 13:23:11 +00:00
BUILTIN ::= num | bool | str