Reputation: 91
I'm using ANTLRWorks 1.5.2 for grammar creation and subsequent creation of the lexer and parser. I did that for Java target, but my preferred language is python. I'm quite puzzled by this: how can I specify my target language in ANTLRWorks 1.5.2 and get lexer and parser in python? I read somewhere that antlrworks in just for java target. How can I install antlr3 and use python runtime? I would be really appriciate if anyone can guid me. thanks.
Upvotes: 3
Views: 1966
Reputation: 170148
If you use the following options {...}
block in your grammar:
options {
language=Python;
}
and then press CTRLSHIFT + G from within ANTLRWorks, the *.py
lexer and parser files will be generated in the grammar's output/
directory.
However, debugging from within ANTLRWorks only works with the Java target.
As for a complete Python example, checkout this previous Q&A: ANTLR get and split lexer content
Upvotes: 2