Skip to content

Latest commit

 

History

History
36 lines (27 loc) · 1.49 KB

File metadata and controls

36 lines (27 loc) · 1.49 KB

CS4450 Parser Project

This is the final project for CS4450 - Principles of Programming Langauges. This project implements a basic parser for a subset of Python using ANTLR. It is tested with Python.

Getting Started

Dependencies

Usage

To use, firist download the source code. In your preferred terminal run:

antlr4 -Dlanguage=Python3 PythonParser.g4

The grammar then be compiled on your machine. Then you can run python main.py to generate a parse "tree".

Alternative way to generate parse tree...

  1. Search lab.antlr.org
  2. Click top left "Lexer" tab
  3. Delete everything in Lexer's window
  4. Return to "Parser" tab
  5. Copy & Paste in everything in this repository's "grammar/PythonParser.g4" file
  6. Copy & Paste in any file in this repository's "grammar/examples/" folder to antlr lab's right "Input" window
  7. Click run to generate a parse "tree"

If you'd like to try your own input file, you can create a new python file and write some code (note that not all python syntax is supported), then modify main.py to run your specified file or paste this into "Input" window of lab.antlr.org website.

Project Demo

Demo Video

Authors

  • Wen-Hsin Chen
  • Julian Fletcher
  • Braeden Songer
  • Evelyn Wilbur