Formal Languages & Compilers (FJP)
FJPGramatikySyntaktická analýzaLL(1)LR parseryPřekladače

Context-Free Grammar Analyser

Educational tool for grammar analysis, transformations, and parser construction

An educational web application for the Formal Languages and Compilers course. It analyzes context-free grammars, performs equivalent grammar transformations, computes FIRST and FOLLOW sets, constructs parsing tables, and simulates various parser implementations.

/fjp/grammar-analyser/index.html
Context-Free Grammar Analyser interface screenshot
Launch Interactive Simulation

Grammar analysis, FIRST and FOLLOW set computation, and LL(1) parsing table construction

Project Overview & Context

Used as a teaching aid in compiler courses. Users enter grammars in standard notations (lecture arrow notation, BNF, Bison, or ANTLR) and step through algorithms covered in lectures: grammar reduction, left recursion elimination, left factoring, LL and LR classification, and counterexample generation for parsing table conflicts.

Key Features & Capabilities

FIRST & FOLLOW Sets

Computation of FIRST and FOLLOW sets with step-by-step logs of applied derivation rules.

LL & LR Parsing Tables

Construction of LL(1) parsing tables, LR(0)/LR(1) item sets, and detection of Shift-Reduce and Reduce-Reduce conflicts.

Grammar Transformations

Removal of unreachable and non-terminating symbols, elimination of epsilon- and unit-rules, left recursion elimination, and left factoring.

Conflict Counterexamples

Search for concrete input strings that trigger parsing table conflicts or grammar ambiguities.

Parser Simulation

Step-by-step parsing simulation for recursive descent, LL(1) predictive parsing, operator precedence, and general algorithms (Earley, CYK, GLR).

Parser Code Generation

Parser code generation in C, Python, JavaScript, PL/0, and Oberon, including error recovery routines.

Educational Value & Pedagogical Context

Students learning formal languages often make clerical errors when manually deriving sets or verifying LL(1) criteria. The tool provides immediate verification and displays all intermediate derivation steps.