a bit more progress on lua bindings
[philodendron.git] / sketches / rtn.parser
blob95b93f7cf5ef6f8d93bfbbf16abef7724c0aca5f
2 grammar     -> statement*;
3 statement   -> nonterm "->" derivations ";" | "ignore" nonterm "in" nonterm +(,);
4 derivations -> ( "e" | derivation ) +(|);
5 derivation  -> term+;
6 term        -> ( name "=" )? (regex | string | nonterm | ( "(" derivations ")" ) ) modifier ? ;
7 name        -> /\w+/;
8 modifier    -> "?" | "*" | "+" | ("*" | "+") "(" ( /[^)]*/ | string ) ")";
9 nonterm     -> /\w+/;
10 string      -> '"' /([^"]|\\")*/ '"';
11 string      -> "'" /([^']|\\')*/ "'";
12 regex       -> "/" /([^\/]|\\\/)*/ "/";
14 whitespace  -> /[\r\n\s\t]+/;
15 allow whitespace in grammar, statement, derivations, derivation, term;