Context-free grammar
Definition
A context-free grammar is a formal grammar in which every rule has the form with and . The relation , derivations and the language are those of the formal grammar.
Remarks
Example: , , . Every left side is the single nonterminal , so this grammar is context-free; it generates the balanced strings of brackets. Non-example: a grammar with the rule is not context-free, because the left side has two symbols. A leftmost derivation rewrites the leftmost nonterminal at each step. A derivation of a string corresponds to a parse tree, a rooted tree with root . Its inner nodes are labelled by nonterminals, the children of a node are read off a rule, and the leaves spell from left to right. Parse trees of are in bijection with leftmost derivations of .
Reading path
To understand this page from the ground up, read these 5 pages in order. The foundations come first.
Show the path as a graph
- no evidence level
- Formal grammar concept
- Formal language concept
- Rooted tree concept
- String concept
- Context-free grammar definition
Further reading
About this page
| Tag | 8R5ZPQ7893 |
|---|---|
| URI | m2://8R5ZPQ7893 |
| Kind | definition |
| Writing | W0 stub |
| MSC | 68Q42, 68Q45 |
| Defines | Context-free grammar |
| Uses | Formal grammar, Formal language, String, Rooted tree |
| Changed | 3 November 2026 |
Markdown · JSON · Edit on GitHub
What this page needs for W1
- a source with a locator (0 of 1)
The writing levels say how complete the text of a page is. They do not measure its truth.
What links here
No page links to this page yet.