A lexical and syntax analyzer for a custom programming language grammar in Python 3.12. It parses input code and generates an Abstract Syntax Tree (AST) based on the specified grammar.
- Lexical Analysis: Breaks down source code into tokens.
- Syntax Analysis: Validates the structure of the code against the defined grammar.
- Abstract Syntax Tree (AST): Constructs a tree representation of the code for easy analysis.
The language grammar is defined in Backus-Naur Form (BNF) and can be found in the grammar.txt
file.
To run the program, execute main.py
.
Your source code should be provided in a plain text file format. Ensure that the file adheres to the specified grammar for accurate parsing.
usage: main.py [-h] file
positional arguments:
file Path to the code file.
options:
-h, --help show this help message and exit
Here's how to run the program with a sample code file:
python main.py path/to/your/code.txt
This project is licensed under the MIT License - see the LICENSE file for details.