ErSantis / TopDownParser_LL1-React

LL(1) grammar analyzer and parser simulator built with React and TypeScript. Calculates First/Follow sets, builds M-table, and simulates parsing.

Home Page:https://top-down-parser-psi.vercel.app

Repository from Github https://github.comErSantis/TopDownParser_LL1-ReactRepository from Github https://github.comErSantis/TopDownParser_LL1-React

LL(1) Grammar Analyzer โ€” Non-Recursive Descent Parser

A web-based tool built in React + TypeScript for analyzing context-free grammars and simulating LL(1) parsers. This tool helps users understand and visualize compiler construction techniques such as First/Follow sets, left recursion removal, and predictive parsing.


๐Ÿ“š Features

  • โœ๏ธ Input grammar via web UI
  • ๐Ÿงฎ Calculate First and Follow sets
  • ๐Ÿ” Remove left recursion
  • ๐Ÿช„ Apply left factoring
  • ๐Ÿ“Š Generate LL(1) parsing table (M-table)
  • โš™๏ธ Simulate non-recursive descent parsing
  • ๐ŸŒ Interactive and responsive interface

๐Ÿš€ Getting Started

Prerequisites

  • Node.js โ‰ฅ 16.x
  • npm or yarn

Installation

git clone https://github.com/your-username/LL1-grammar-analyzer.git
cd LL1-grammar-analyzer
npm install

Run Locally

npm run dev

Open http://localhost:5173 in your browser.


๐Ÿง  How It Works

  1. Input Grammar: Define non-terminals, terminals, and production rules.
  2. Preprocessing: Handles elimination of left recursion and left factoring.
  3. First/Follow Sets: Uses algorithms to derive sets for each non-terminal.
  4. M-Table Construction: Based on the First and Follow sets, builds parsing table.
  5. Parser Simulation: Enter input string and see the parsing process in action.

๐Ÿ›  Technologies Used

Area Tech Stack
Frontend React, TypeScript
Tooling Vite
State & Logic Custom Context + Hooks
Styling CSS Modules

๐Ÿ“ฆ Folder Structure

src/
โ”œโ”€โ”€ components/       # UI components (input, results, simulation)
โ”œโ”€โ”€ styles/           # CSS Modules for each component
โ”œโ”€โ”€ utils/            # Grammar logic (first, follow, m-table, transformations)
โ”œโ”€โ”€ types/            # TypeScript types
โ””โ”€โ”€ main.tsx          # App entry point

๐Ÿงช Example Use Case

  • Input Grammar:
    S -> A a | b
    A -> A c | d
    
  • First & Follow sets are calculated.
  • Left recursion removed from A -> A c | d.
  • Predictive table created and parsing simulated.

๐ŸŒ Live Demo

Vercel


๐Ÿ“„ License

MIT License


๐Ÿ™Œ Authors

Developed as a compiler theory project by a team passionate about education and software engineering.

LL(1) Grammar Analyzer โ€” Non-Recursive Descent Parser

A web-based tool built in React + TypeScript for analyzing context-free grammars and simulating LL(1) parsers. This tool helps users understand and visualize compiler construction techniques such as First/Follow sets, left recursion removal, and predictive parsing.


๐Ÿ“š Features

  • โœ๏ธ Input grammar via web UI
  • ๐Ÿงฎ Calculate First and Follow sets
  • ๐Ÿ” Remove left recursion
  • ๐Ÿช„ Apply left factoring
  • ๐Ÿ“Š Generate LL(1) parsing table (M-table)
  • โš™๏ธ Simulate non-recursive descent parsing
  • ๐ŸŒ Interactive and responsive interface

๐Ÿš€ Getting Started

Prerequisites

  • Node.js โ‰ฅ 16.x
  • npm or yarn

Installation

git clone https://github.com/your-username/LL1-grammar-analyzer.git
cd LL1-grammar-analyzer
npm install

Run Locally

npm run dev

Open http://localhost:5173 in your browser.


๐Ÿง  How It Works

  1. Input Grammar: Define non-terminals, terminals, and production rules.
  2. Preprocessing: Handles elimination of left recursion and left factoring.
  3. First/Follow Sets: Uses algorithms to derive sets for each non-terminal.
  4. M-Table Construction: Based on the First and Follow sets, builds parsing table.
  5. Parser Simulation: Enter input string and see the parsing process in action.

๐Ÿ›  Technologies Used

Area Tech Stack
Frontend React, TypeScript
Tooling Vite
State & Logic Custom Context + Hooks
Styling CSS Modules

๐Ÿ“ฆ Folder Structure

src/
โ”œโ”€โ”€ components/       # UI components (input, results, simulation)
โ”œโ”€โ”€ styles/           # CSS Modules for each component
โ”œโ”€โ”€ utils/            # Grammar logic (first, follow, m-table, transformations)
โ”œโ”€โ”€ types/            # TypeScript types
โ””โ”€โ”€ main.tsx          # App entry point

๐Ÿงช Example Use Case

  • Input Grammar:
    S -> A a | b
    A -> A c | d
    
  • First & Follow sets are calculated.
  • Left recursion removed from A -> A c | d.
  • Predictive table created and parsing simulated.

๐ŸŒ Live Demo

Coming Soon (or host it on Vercel / Netlify for easy sharing)


๐Ÿ“„ License

MIT License


๐Ÿ™Œ Authors

Developed as a compiler theory project by me :)

About

LL(1) grammar analyzer and parser simulator built with React and TypeScript. Calculates First/Follow sets, builds M-table, and simulates parsing.

https://top-down-parser-psi.vercel.app

License:MIT License


Languages

Language:TypeScript 80.5%Language:CSS 16.4%Language:JavaScript 2.1%Language:HTML 1.0%