A parser which translates Autolev code to PyDy code.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
antlr_essentials
test_files
Autolev.g4
AutolevLexer.py
AutolevListener.py
AutolevParser.py
README.md
autolev.py
myListener.py
output1.txt
pydy_for_autolev_users.rst

README.md

autolev-parser

Code Setup

  1. The antlr_essentials directory contains the antlr jar file and some bat files. If you want to run antlr commands, first specify the classpath of this jar file in the commands prompt.

  2. The test files directory contains the example test files on which I run the code. The files example5.1-example5.9 are examples of the same names in the Autolev Tutorial.  I have also included whipple.txt which is the bicycle model Autolev code. The directory also contains png image files of the parse trees generated when the grammar is run on these test files.

  3. Autolev.g4 is the grammar file. AutolevLexer.py, AutolevParser.py and AutolevListener.py are files automatically generated by ANTLR. A listener is basically a tree walker which triggers events when it enters and exits a rule. One can use this mechanism by subclassing AutolevListener.

  4. The file myListener.py contains the myListener class which simply subclasses AutolevListener. This is where I will be putting the majority of the parser code.

  5. The file autolev.py initializes the parser, lexer and listener and is the file you would want to run. Running 'python autolev.py input.txt' on the file input.txt which contains Autolev code would generate the parsed SymPy output in an output file of choice.

  6. The pydy_for_autolev_users.rst is a guide and I will keep updating it as I keep parsing more of the Autolev language.