On Jul 10, 1:25 pm, "Catherine Rodgers" <
cmrodg...@gmail.com> wrote:
> The manual says:
>
> > There are also some grammars that will be compiled incorrectly. For example:
>
> > bad -> "X" "Y" | "X";
>
> > .... This is an incorrect error from Gazelle — "X" alone should be valid input.
>
> I'm hitting up against this error in creating my grammar. What's the
> ETA on getting a fix for it? (That is, is this an easy fix that you
> just need to get around to, or is it a major reworking of some portion
> of Gazelle?)
It's small-ish. I was hoping to fix several of the caveats and
release 0.2.1, 0.2.2, etc. within a few weeks.
> As an unimportant aside, gzlparse gives a slightly different error
> text than the manual's example. For the grammar:
>
> test -> "X" "Y"? ;
>
> it gives the following error message for input "X":
>
> gzlparse: interpreter.c:503: do_intfa_transition: Assertion
> `terminal' failed.
This is actually a grammar that Gazelle handles properly (this may
look equivalent to the other grammar that does not work, and indeed it
recognizes the same language, but the two generate different parse
trees and thus must be parsed differently). I suspect that what is
happening in this case is that you are using an editor that is
appending a newline to the end of your test file. So when you type
"X" in your input file, what Gazelle is really seeing is:
$ hexdump -C /tmp/test
00000000 58 0a |X.|
00000002
So after Gazelle sees and accepts the "X", it is expecting either a
"Y" or EOF. But it gets neither, it gets a newline. So the parse
fails.
The reason this isn't affecting other grammars like:
test -> "X";
...is that after Gazelle sees "X" in the input, there is no possible
way for the grammar to accept any more characters. So Gazelle halts
and never sees the newline that your editor appends.
Josh