A beautiful, interactive Abstract Syntax Tree (AST) visualizer built exclusively with Vanilla JavaScript, HTML, and CSS. This project serves as a dynamic demonstration of core Compiler Design principles, including Lexical Analysis, Tokenization, and Recursive Descent Parsing.
- Lexical Analyzer: Tokenizes C/JS style inputs (Keywords, Literals, Operators).
- Recursive Descent Parser: Evaluates grammar to build a dynamic JSON AST.
- Dynamic Tree Visualization: Fully interactive tree rendered continuously with responsive animated SVG
Cubic Beziercurves. - Detailed Token Table: Outputs immediate breakdown charts of lexer logic.
- Zero Dependencies: Entirely standalone structure with no Webpack, Babel, or React overhead.
Due to CORS policies on local browser files parsing scripts dynamically, you must serve the application on a local server.
Option 1: Using Node (npx)
npx serve .Option 2: Using Python
python -m http.server 8000Then visit: http://localhost:8000
/js/lexer.js- Consumes strings into definedTokens./js/parser.js- Recursively scales Tokens forming parent/child relationships./js/result.js- Computes physical monitor bounds dynamically drawing Bezier SVG branches between divs.
This project is licensed under the MIT License - see the LICENSE file for details.