Python project providing a lexical analyzer and recursive-descent parser for a custom grammar. This repository contains the backend code used by a simple web UI for visualizing tokens and parse trees.
- Tokenizer / lexer
- Recursive descent parser
- Web frontend (Flask) serving static HTML/CSS/JS to interact with the parser
- Utilities for error handling and visualization
app.py- Flask application entrypointconfig.py- Application configurationlexer/- Tokenizer and token type definitionsparser/- Grammar, recursive descent parser, and parse tree utilitiestemplates/- Jinja2 HTML templates for the web UIstatic/- CSS and JS for the front endutils/- Helper utilities (errors, visualizer)requirements.txt- Python dependenciestext_analyzer.py- (Top-level script, likely for CLI/testing)
Prerequisites
- Python 3.10+ recommended
- pip
cd PLCDModule/lexical-analyzer/
python -m venv venv
source venv/bin/activate # Mac/Linuxvenv\Scripts\activate # Windows
pip install -r requirements.txt
python app.py
export FLASK_APP=app.py
export FLASK_ENV=development
flask run5. Open browser & Navigate to http://localhost:3000
There are no automated tests included in this repo currently. Adding unit tests for the tokenizer and parser is highly recommended.