-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segfault when setting precedence on a rule with empty rhs #22
Comments
Here I¡m attaching the postgresql-13.3 and sqlite3 converted grammars with the rules with empty rhs and precedence where the precedence were commented out to be able to process with unicc, Just converted:
Commented to allow process with unicc:
|
On my previous messages where I wrote "empty lhs" in reality it's "empty rhs". |
After reading almost all manual I've changed the conversion from yacc to unicc grammar to output quoted strings for terminals instead of @regex and also add |
It segfaults here:
Where
Do we accept multiple |
This seems to fix the segfault problem:
|
With the previous fix now we can process the converted grammar for |
Hello @mingodad, thank you very much for your diving into this issue and finding a fix for the problem. Indeed, the production-directives could be parsed by changing the grammar to accept just Unfortunately, I don't spend much time on unicc and its abandoned successor unicc2 currently, as my focus moved to other projects. Anyway, I think your pull request is helpful and makes unicc a little bit more stable. I still like the idea of having one grammar and turning it into several target languages, optionally without change. Maybe this feature could be part of another, more actively developed program, for example Lark. |
Segfault fixed by #24 |
Making comparisons of 'LALR(1)' grammars between parsers with a modified version of byacc and lemon to convert the grammars (see https://github.com/mingodad/lalr-parser-test) I converted the sqlite3 grammar to unicc with
byacc -C sqlite3-parser.y
and when running the resulting converted grammar we get segfault because there is a rule with an empty rhs and a precedence (postgresql-13-3 also have several of then), to facilitate see the problem I'm posting a dummy small grammar that also segfault due to the empty rhs and precedence, also with the converted postgresql-13.3 unicc takes a long time to process it (unicc -> 100s, byacc -> 1.2s)The text was updated successfully, but these errors were encountered: