Hi, I am Markus, also working on this project. Thanks for your reply.
The errors on the grammar resulted from the reducing of the original one - just to give a minimal example. The original one featured the issues you mentioned in addition to other logial operators like nand, xor, equivalent, and more options on the atom (all literals, special chars, etc.). As this grammar is more complex, it might not have been useful to post here and it also is much slower: the example does not take about 20 seconds to parse, but we get a OutOfMemoryException after a couple of minutes... Anyway, I will attach it to this post. The javacc grammar does not produce the same data structure, but a tree of java objects. If we cannot enhance the performance of the instaparse grammar, we would take the javacc parser and produce direct persistent clojure data structures with it. I attach the grammar to this post. We will right now try your idea on parsing n-ary operators - hopefully not generating more ambiguity - and post the results. Meanwhile we will gather access to the instaparse group. -- -- 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.
(* entry point *) <S> = expr (* literals *) atom = <spc> ((letter|special) (letter|special|digit)*) <spc> <letter> = #"[A-Za-zÄÖÜäöü]" <special> = #"[\_\{\}\.\\]" (* _ { } . \ *) <digit> = #"[0-9]" <spc> = #"\s*" (* token *) XOR = <spc> ("xor"|"^") <spc> EQUIV = <spc> ("iff"|"<->") <spc> NIMPL = <spc> ("nimpl"|"!->") <spc> IMPL = <spc> ("impl"|"->") <spc> NIF = <spc> ("nif"|"!<-") <spc> IF = <spc> ("if"|"<-") <spc> NOR = <spc> ("nor"|"!|") <spc> OR = <spc> ("or"|"|") <spc> NAND = <spc> ("nand"|"!&") <spc> AND = <spc> ("and"|"&") <spc> NOT = <spc> ("not"|"!") <spc> LPAREN = <spc> "(" <spc> RPAREN = <spc> ")" <spc> LBRACK = <spc> "[" <spc> RBRACK = <spc> "]" <spc> (* constants *) <constant> = <spc> (true|false) <spc> true = <("True"|"true"|"T"|"t"|"1")> false = <("False"|"false"|"F"|"f"|"0")> (* unary operators *) not = <NOT> unexpr (* binary operators *) (* precedence, ascending order OP ASSOC equiv, xor left impl, nimpl right if, nif right or, nor left and, nand left *) <expr> = equiv_xor <equiv_xor> = xor | equiv | impl_nimpl equiv = equiv_xor <EQUIV> impl_nimpl xor = equiv_xor <XOR> impl_nimpl <impl_nimpl> = nimpl | impl | if_nif impl = if_nif <IMPL> impl_nimpl nimpl = if_nif <NIMPL> impl_nimpl <if_nif> = if | nif | or_nor if = or_nor <IF> if_nif nif = or_nor <NIF> if_nif <or_nor> = or | nor | and_nand or = or_nor <OR> and_nand nor = or_nor <NOR> and_nand <and_nand> = and | nand | unexpr and = and_nand <AND> unexpr nand = and_nand <NAND> unexpr <unexpr> = not | subexpr <subexpr> = constant / atom / <LPAREN> expr <RPAREN> / <LBRACK> expr <RBRACK>
MpaParser.jjt
Description: Binary data