40 lines
No EOL
762 B
Text
40 lines
No EOL
762 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 ";"
|
|
equation: expr "=" expr
|
|
|
|
expr: expr_dot
|
|
| expr_add
|
|
| expr_mul
|
|
| expr_call
|
|
| expr_name
|
|
expr_dot: expr "." expr
|
|
expr_add: expr "+" expr
|
|
expr_mul: expr "*" expr
|
|
expr_call: expr "(" args ")"
|
|
expr_name: ident
|
|
args: sep_trail{expr, ","}
|
|
|
|
ident: IDENT
|
|
IDENT: /([a-zA-Z][a-zA-Z0-9_]*)|(_[a-zA-Z0-9_]+)/
|
|
|
|
%import python.STRING
|
|
%import common.WS
|
|
%ignore WS |