Skip to content

Instantly share code, notes, and snippets.

@Ra1nWarden
Created February 14, 2014 15:47
Show Gist options
  • Save Ra1nWarden/9003351 to your computer and use it in GitHub Desktop.
Save Ra1nWarden/9003351 to your computer and use it in GitHub Desktop.
// This does not work
S
: LBRACE exp_s RBRACE { $$ = $2}
;
exp_s
: { $$ = []; }
| exp SEMI exp_s { $$ = $3.unshift($1); }
exp
: /*omitted*/
// This works
S
: LBRACE exp_s RBRACE { $$ = $2}
;
exp_s
: { $$ = null; }
| exp_p { $$ = $1; }
;
exp_p
: exp SEMI { $$ = [$1];}
| exp SEMI exp_p { $$ = $3.unshift($1);}
;
exp
: /*omitted*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment