I had a look at the python run time module but I am unsure about creating the python parser and lexer files. I have written the .g files.
Asked
Active
Viewed 1,062 times
1 Answers
3
Here are the steps:
- Write the grammar.
- Run ANTLR to generate the lexer/parser classes.
- Compile and run against Python source files to see how you do.
To accomplish anything useful, you'll have to get the code into an AST and then walk the tree. Did you do that? What did you get?
Here's a list of available grammars. It includes Python 3. How did you grammar compare?

duffymo
- 305,152
- 44
- 369
- 561
-
thanks for your response, I just realised you have to generate the parser with java =.=" – user944308 Sep 14 '11 at 10:11
-
I'd appreciate you voting up and accepting the answer far more than your thanks. – duffymo Sep 14 '11 at 10:24
-
@duffymo is it possible to generate lexer and parser in the code instead of doing this manually? – Natalie Perret Mar 05 '19 at 08:53
-
link is not working – Jurakin Feb 18 '22 at 06:30
-
Fixed it for you. Google could have found you a replacement with a little effort. – duffymo Feb 20 '22 at 14:12