Notes

Syntax

“The cat the dog chased ran.” You can read that sentence, and nothing in the individual words told you who did the chasing — the arrangement did. Syntax is the study of that arrangement: the rules by which words combine into phrases, and phrases into sentences.

Structure, not meaning
Syntax sits above morphology, which handles the shape of single words, and below semantics, which handles what they mean. It is blind to sense on purpose: Chomsky's “colorless green ideas sleep furiously” is perfectly well-formed and says nothing at all, while a scrambled version of the same words is rejected by the grammar outright. Computationally, structure gets written down two ways:

  • A constituency tree groups words into nested phrases — a noun phrase inside a verb phrase, as in the Penn Treebank.
  • A dependency tree links each word to its head instead, so chased points directly at its subject and its object — the format behind Universal Dependencies and spaCy's parser.

Why it matters
Word order is where “dog bites man” separates from “man bites dog”, and any representation that discards it — a bag of words, a TF-IDF vector — loses that distinction permanently. Structure is also what resolves genuine ambiguity: “I watched the man with the telescope” has two readings, and only an attachment decision picks one. Transformer encoders pick up a surprising amount of this on their own, but explicit structure still earns its keep where distance matters — a sentiment classifier that must notice a negation three clauses away, a relation extractor hunting the subject of a verb buried in a long contract sentence.

Syntax is the level of language that governs how words combine into phrases and sentences — word order, agreement and structural relations — independently of what those words mean. It is represented computationally as a constituency tree of nested phrases or a dependency tree linking each word to its head. Syntax carries who did what to whom, so representations that discard word order cannot recover it, and structural ambiguity stays unresolved without it.

“The burglar chased the dog” and “the dog chased the burglar” use the same words and describe opposite events. What changed is the order — and order is what syntax is about.

Syntax is the set of unwritten rules that decide how words slot together: what can go where, what must agree with what, which words belong with which. A child absorbs them long before learning any grammar terms. Software has to be shown them, because without a sense of structure it sees only a pile of words. Structure is how a program works out that in “I watched the man with the telescope”, the telescope is what you looked through, not something the man was carrying.