Skip to content

Instantly share code, notes, and snippets.

@scientific-coder
Last active October 17, 2018 10:44
Show Gist options
  • Save scientific-coder/b642e118afb07f524b1cf7b55aa8d727 to your computer and use it in GitHub Desktop.
Save scientific-coder/b642e118afb07f524b1cf7b55aa8d727 to your computer and use it in GitHub Desktop.
(def addsub-parser
(instaparse.core/parser
"prog= spaces? add-sub spaces?
<add-sub> = number | add | sub
add= add-sub spaces? <'+'> spaces? number
sub= add-sub spaces? <'-'> spaces? number
number= #'-?[0-9]+'
<spaces> = <#'\\s+'>"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment