I'm not the OP, but if you mean comments within the grammar, sure as long as "comment" is well defined, and if you mean comments *about* the grammar within the parser code, how about creating the grammar using (str) with one string per line, and putting your comments after each line's string?
-Steven On Thu, Apr 11, 2013 at 9:08 AM, Stathis Sideris <side...@gmail.com> wrote: > Thanks, this looks fantastic! Is there any way to include comments in the > syntax at all? > > Thanks, > > Stathis > > > On Tuesday, 9 April 2013 06:18:39 UTC+1, puzzler wrote: >> >> Instaparse is an easy-to-use, feature-rich parser generator for Clojure. >> The two stand-out features: >> >> 1. Converts standard EBNF notation for context-free grammars into an >> executable parser. Makes the task of building parsers as lightweight and >> simple as working with regular expressions. >> >> 2. Works with *any* context-free grammar. This means you don't have to >> learn the esoteric subtleties of LR, LL, LALR or any other specialized >> subset. Left-recursion, right-recursion, ambiguous grammars -- instaparse >> handles it all. >> >> Example: >> >> (def as-and-bs >> (parser >> "S = AB* >> AB = A B >> A = 'a'+ >> B = 'b'+")) >> >> => (as-and-bs "aaaaabbbaaaabb") >> [:S >> [:AB [:A "a" "a" "a" "a" "a"] [:B "b" "b" "b"]] >> [:AB [:A "a" "a" "a" "a"] [:B "b" "b"]]] >> >> https://github.com/Engelberg/**instaparse<https://github.com/Engelberg/instaparse>for >> full feature list and extensive tutorial. >> > -- > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.