Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌳 AST Generator (Compiler Design)

AST Generator UI Language License

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.

✨ Features

  • 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 Bezier curves.
  • Detailed Token Table: Outputs immediate breakdown charts of lexer logic.
  • Zero Dependencies: Entirely standalone structure with no Webpack, Babel, or React overhead.

🚀 Quick Start

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 8000

Then visit: http://localhost:8000

🛠️ Architecture

  • /js/lexer.js - Consumes strings into defined Tokens.
  • /js/parser.js - Recursively scales Tokens forming parent/child relationships.
  • /js/result.js - Computes physical monitor bounds dynamically drawing Bezier SVG branches between divs.

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A dynamic Abstract Syntax Tree (AST) visualizer built with Vanilla JS. Features a built-in Lexer and Recursive Descent Parser to translate C/JS code natively into an interactive node tree.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages