Selected Node
Click any syntax-tree node to view its type and properties.
Token Stream
0 tokens
Tokens will appear after parsing.
Symbol Table
0 symbols
Functions, parameters, and variables collected from the current program.
Symbols will appear after parsing.
Generate a tree to view JSON.
Grammar Summary
program → statement* EOF
statement → declaration | function | expression ";"
| "print" "(" expression ")" ";"
| "if" "(" expression ")" statement
("else" statement)?
| "while" "(" expression ")" statement
| "for" "(" init ";" test ";" update ")" statement
| "do" statement "while" "(" expression ")" ";"
| "return" expression? ";" | "break" ";" | "continue" ";"
block → "{" statement* "}"
declaration → (let | var | const | type) declarator ("," declarator)* ";"
function → ("function" | type) ID "(" parameters? ")" block
expression → assignment | conditional
assignment → conditional assignment-operator assignment | conditional
assignment-operator → "=" | "+=" | "-=" | "*=" | "/=" | "%="
| "&=" | "|=" | "^=" | "<<=" | ">>="
logical-or → logical-and ("||" logical-and)*
logical-and → bitwise-or ("&&" bitwise-or)*
bitwise-or → bitwise-xor ("|" bitwise-xor)*
bitwise-xor → bitwise-and ("^" bitwise-and)*
bitwise-and → equality ("&" equality)*
equality → comparison (("==" | "!=") comparison)*
comparison → shift (("<" | "<=" | ">" | ">=") shift)*
shift → term (("<<" | ">>") term)*
term → factor (("+" | "-") factor)*
factor → unary (("*" | "/" | "%") unary)*
unary → ("!" | "-" | "+" | "~" | "&" | "*" | "++" | "--") unary | postfix
postfix → primary (call | index | "++" | "--")*
primary → literal | ID | array | "(" expression ")"