Skip to content

Instantly share code, notes, and snippets.

@andy-morris
Created October 26, 2014 20:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andy-morris/4157b6513555415e3127 to your computer and use it in GitHub Desktop.
Save andy-morris/4157b6513555415e3127 to your computer and use it in GitHub Desktop.
spot the left recursion
ident = tok.ident[&make_id];
id_expr = ident[&make_id_expr];
int_expr = tok.int_[&make_int_expr];
paren_expr %= '(' > expr > ')';
atomic_expr %= id_expr | paren_expr;
lam_expr = ("fn" > ident > "=>" > expr)[&make_lam_expr];
app_expr = (+atomic_expr)[&make_app_expr];
expr %= lam_expr | app_expr;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment