54 lines
No EOL
919 B
Text
54 lines
No EOL
919 B
Text
program: decl*
|
|
|
|
?decl: iface
|
|
| node
|
|
|
|
sep_trail{item, punc}: item (punc item)? punc?
|
|
|
|
iface: "iface" ident "{" sep_trail{iface_field, ","} "}"
|
|
iface_field: ident ":" ident
|
|
|
|
node: NODE ident ":" ident "{" variant* "}"
|
|
variant: prod "=>" "{" equation_* "}"
|
|
prod: sym*
|
|
sym: sym_rename
|
|
| STRING
|
|
sym_rename: "<" ident ":" node_ref ">"
|
|
node_ref: node_ref_name
|
|
| STRING
|
|
node_ref_name: ident
|
|
equation_: equation SEMI
|
|
equation: expr EQ expr
|
|
|
|
expr: expr_dot
|
|
| expr_add
|
|
| expr_mul
|
|
| expr_call
|
|
| expr_name
|
|
expr_dot: expr DOT expr
|
|
expr_add: expr ADD expr
|
|
expr_mul: expr MUL expr
|
|
expr_call: expr LPAR args RPAR
|
|
expr_name: ident
|
|
args: expr (COMMA expr)? COMMA?
|
|
|
|
ident: IDENT
|
|
IDENT: /([a-zA-Z][a-zA-Z0-9_]*)|(_[a-zA-Z0-9_]+)/
|
|
IFACE: "iface"
|
|
NODE: "node"
|
|
LANG: "<"
|
|
RANG: ">"
|
|
ADD: "+"
|
|
MUL: "*"
|
|
COMMA: ","
|
|
COLON: ":"
|
|
LPAR: "("
|
|
RPAR: ")"
|
|
EQ: "="
|
|
DOT: "."
|
|
SEMI: ";"
|
|
THICCARROW: "=>"
|
|
|
|
%import python.STRING
|
|
%import common.WS
|
|
%ignore WS |