Created
October 29, 2009 13:48
-
-
Save cgrand/221456 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; implicit pass on :space | |
(def g | |
(grammar {:space :space | |
:main :expr*} | |
:space [" "+] | |
:expr #{:symbol ["(" :expr* ")"]} | |
:symbol ["a"+ "b" (but "a" "b")])) | |
(comment | |
=> (-> g (step "(ab ab)") eof) ; yuk! | |
([nil [[{:tag :expr, :content ["(" {:tag :expr, :content [{:tag :symbol, :content ["ab"], :length 2}], :length 2} {:tag :space, :content [" "], :length 1} {:tag :expr, :content [{:tag :symbol, :content ["ab"], :length 2}], :length 2} ")"], :length 7}] []] nil]) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment