LALR Parser

Construct LALR(1) parsing tables from any context-free grammar and trace the parse step by step

Docker Maven Java Spring Boot
Try the Demo

About the Project

An implementation of LALR(1) parsing built from scratch in Java. Given any context-free grammar, the system constructs the full canonical LR(1) item sets, merges same-core states into an LALR table, detects conflicts, and parses input strings with a detailed step-by-step trace.

The core algorithms were originally built as a compilers course project, then wrapped in a Spring Boot REST API and this interactive web frontend where you can input any grammar, parse any string, and see the parsing tables and trace in real time.

How It Works

1

Define Grammar

Enter a start symbol and production rules for your context-free grammar. Use -> for the arrow (dash followed by >).

2

Build LR(1) Items

The system computes FIRST sets and constructs the full canonical LR(1) item collection.

3

Merge to LALR

States with the same core are merged, producing a compact LALR parsing table.

4

Parse & Trace

Your input is parsed step by step showing the stack, remaining input, and each action taken.

Interactive Demo

Grammar Input

Team

KA

Khalid Al Dosari

KA

Khalid Altamimi