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.
1 Answer
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?
7 Comments
user944308
thanks for your response, I just realised you have to generate the parser with java =.="
duffymo
I'd appreciate you voting up and accepting the answer far more than your thanks.
Natalie Perret
@duffymo is it possible to generate lexer and parser in the code instead of doing this manually?
Jurakin
link is not working
duffymo
Fixed it for you. Google could have found you a replacement with a little effort.
|