49 lines
No EOL
819 B
Text
49 lines
No EOL
819 B
Text
start: decl*
|
|
|
|
decl: iface
|
|
| node
|
|
|
|
iface: IFACE IDENT "{" iface_field (COMMA iface_field)? COMMA? "}"
|
|
iface_field: IDENT COLON IDENT
|
|
|
|
node: NODE IDENT COLON IDENT "{" variant* "}"
|
|
variant: prod "=>" "{" equation_* "}"
|
|
prod: sym*
|
|
sym: sym_rename
|
|
| STRING
|
|
sym_rename: "<" IDENT ":" node_ref ">"
|
|
node_ref: IDENT
|
|
| STRING
|
|
equation_: equation SEMI
|
|
equation: expr EQ expr
|
|
|
|
expr: expr_dot
|
|
| expr_add
|
|
| expr_mul
|
|
| expr_call
|
|
| IDENT
|
|
expr_dot: expr DOT expr
|
|
expr_add: expr ADD expr
|
|
expr_mul: expr MUL expr
|
|
expr_call: expr LPAR args RPAR
|
|
args: expr (COMMA expr)? COMMA?
|
|
|
|
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 |