I am just curious, not requesting this feature :-) How to represent negation in BNF? http://stackoverflow.com/questions/10922352/how-to-represent-negation-in-bnf
http://pythonhosted.org/modgrammar/libref.html modgrammar.EXCEPT(grammar, exc_grammar, **kwargs) Match grammar, but only if it does not also match exception_grammar. (This is equivalent to the - (exception) operator in EBNF) EXCEPT() grammars can also be created by combining other grammars in python expressions using the except operator (-). Note: In many cases there are more efficient ways to design a particular grammar than using this construct. It is provided mostly for full EBNF compatibility. modgrammar.EXCEPT function would do "difference" or "complement" mentioned on stackoverflow. Seems like a sane approach - we know the set we are excluding from. Concerning negating characters - yes, it is quite tricky. I don't yet how to define it... Does S = -"ab" "ab" "c" matches "abc" or just "c"? Dne pondělí, 10. června 2013 12:10:00 UTC+2 puzzler napsal(a): > > > Yeah, that's still not clear to me. It says it is the logical negation of > a "rule" but then goes on to say that it negates the "characters". > What does -"ab" mean? > > If you're just negating characters, in instaparse you can just use regex's > capability to express negative character classes. So, for example, "every > character but an a" is most clearly and efficiently expressed as #"[^a]". > > http://www.regular-expressions.info/charclass.html > -- -- 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.