-
Notifications
You must be signed in to change notification settings - Fork 27
Description
Hej Evgeny,
Very excited to see that the Go version of textmapper has reached feature parity with the Java version (#6). Congrats on the persistence and perseverance. You've done an amazing job.
Of course, with the official Go release of textmapper, I wanted to use it to generate the grammar and parser for the llir project. The Java version was capable of generating the lexer and parser from the LLVM IR grammar (ll.tm), however, given the explicit restriction of the Go version of textmapper to avoid allowing tokens with different casing, we were unable to generate the lexer and parser from the ll.tm grammar using the Go version of textmapper.
More details below:
re: #6 (comment)
I tried to use the latest release of textmapper Go version to generate a lexer and parser for the LLVM IR grammar.
Unfortunately, the official LLVM IR grammar contains cases where the only difference between two tokens is lower case vs. camel case. It contains the nounwind function attribute and the noUnwind function flag.
And, as mentioned in the release notes of textmapper:
similar names in the grammar (capitalization, camel vs snake case, etc.) cause a grammar compilation error to avoid confusion and actual compilation errors down the road
This causes the following error:
$ textmapper generate ll.tm
lalr: 95ms (ll.tm)
ll.tm:346:1: 'noUnwind' and 'nounwind' get the same ID in generated code
I was wondering if there is a potential solution to this issue? E.g. introducing two distinct NonTerminal names in the ll.tm grammar to differentiate the two tokens?
As I'm not controlling the official grammar of LLVM IR, I cannot "fix" the original grammar, but instead have to make it work in textmapper.
Cheers,
Robin