lime/lime.bootstrap

39 lines
1019 B
Plaintext

There is nothing to see here. Go and look at the file called "metagrammar".
: $$ = new lime();
grammar pragma toklist stop : $$->pragma($2, $3);
grammar rewrite stop : $2->update($$);
to grammar
: {$$=array();}
toklist sym : $$[] = $2;
toklist lit : $$[] = $2;
toklist num : $$[] = $2;
toklist str : $$[] = substr($2, 1, -1);
to toklist
sym '=' rhs : $$ = new lime_rewrite($1); $$->add_rhs($3);
sym ':' rhs : $$ = new lime_rewrite($1); $$->add_rhs($3);
rewrite '|' rhs : $$->add_rhs($3);
to rewrite
list : $$ = new lime_rhs($1, '');
list action : $$ = new lime_rhs($1, $2);
to rhs
action : $$ = new lime_action($1, NULL);
action lambda : $$ = new lime_action($1, $2);
sym : $$ = new lime_glyph($1, NULL);
sym lambda : $$ = new lime_glyph($1, $2);
str : $$ = new lime_glyph(substr($1, 1, -1), NULL);
to slot
: $$ = new lime_rhs();
rhs slot : $$->add($2);
rhs prec tok : $$->set_prec_glyph($3);
to rhs
'{' code '}' : $$ = $2;
to action
:
code php : $$.=$2;
code '{' code '}' : $$.='{'.$3.'}';
to code
sym :
lit :
to tok