Replies: 2 comments 5 replies
-
Your grammar is ambiguous. All parse trees you are seeing are valid interpretations of the grammar. You need to make sure that there is exactly one possible parse Tree, and that that is the one you want. I would recommend using @erezsh It might be interesting to have an |
Beta Was this translation helpful? Give feedback.
-
I'll go back and try to remove the ambiguity. But it's weird that the same input and same script can produce different output on different runs. If nothing else changes, shouldn't the tree always be the same? |
Beta Was this translation helpful? Give feedback.
-
I have defined a grammar. The goal is to have something where a user can specify a logical condition to be met, like
foo or bar
. I am testing a more complicated example,foo in [FIELD] or bar in [FIELD]
. The problem I have is that about half the time the tree produced by the parser is what I expect, and about half the time it is something different.I have created a test script, lark_test.txt that has my full grammar and just prints the results of
pretty()
. On three separate runs, it produced three different trees, which you can see in the file output.txt.I'm kind of at a loss here. Any help would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions