Home▸Mathematics▸Linguistics Syntax Analysis Simulation

🧪 Linguistics Syntax Analysis Simulation

Watch the CYK dynamic-programming parser fill a 3D syntax chart cell by cell, applying a context-free grammar's rewrite rules to discover every legal sentence structure -- including genuine structural ambiguity like PP-attachment.

Mathematics2DModerate60 FPS📱 Mobile-adapted
linguistics-syntax-analysis-simulation ↗ Open standalone

Syntax analysis asks a precise question: given a grammar's rewrite rules, which structures can legally produce a sentence? This simulator runs the CYK (Cocke–Younger–Kasami) dynamic-programming algorithm on a small context-free grammar in Chomsky Normal Form, filling a triangular 3D chart one span-length layer at a time. Every tower is a chart cell; its height counts how many distinct derivations reach that span, and its colour shows the strongest grammatical category found there. Step through the three preset sentences — including the classic "the dog saw the cat with the telescope" prepositional-phrase attachment case — to watch grammatical ambiguity emerge as a genuinely taller tower at the root, not just a diagram of one possible tree.

⚙ Under the hood

This simulation introduces users to syntax analysis – the study of sentence structure. It demonstrates how grammatical rules are applied to parse and understand the relationships between words in a sentence.

Syntax AnalysisLinguisticsParsing

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)