vxe
vxe

Reputation: 3

How to combine antlr parser and lexer files

Essentially I would like to combine these g4 files:

https://github.com/apache/groovy/tree/master/src/antlr

into a single file which I can use with this clojure library:

https://github.com/aphyr/clj-antlr

which currently requires a combined parser/lexer file. How does one hack the files so they exist as correct grammar in a single file? I've rule out concatenating the files and removing the lexer and parase gammar prefixes as described here: https://github.com/antlr/antlr4/blob/master/doc/grammars.md

Upvotes: 0

Views: 1318

Answers (1)

Mike Lischke
Mike Lischke

Reputation: 53357

You cannot combine these grammars, because the lexer grammar uses an own super class and lexer modes. Both are not possible with a combined grammar.

Upvotes: 3

Related Questions