Skip to content

Instantly share code, notes, and snippets.

@escanda
Created November 16, 2021 17:00
Show Gist options
  • Save escanda/b83aab7a1178562c546b3f637eb5fc90 to your computer and use it in GitHub Desktop.
Save escanda/b83aab7a1178562c546b3f637eb5fc90 to your computer and use it in GitHub Desktop.
(defmacro define-grammar (&rest body)
`(loop for rule in ,@body collect
(format nil "rule: ~A\\n" rule)))
(cl-glrp:define-grammar
`((rulelist ((rule_*) EOF)) # this works, but doesn't without backquotting
(rule_ (lhs ASSIGN rhs))
(lhs "HELLO")
(rhs "WORLD")
(ASSIGN "=")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment