Aka. phrase-structure grammar. A 4-tuple where:
- — non-terminals
- — terminals
and are disjoint. - — start symbol
- — productions
where and contains non-terminal
Productions impose no length constraint. Both the LHS and RHS can contain any mix of terminals and non-terminals.
LHS must contain non-terminal. This is the only restriction.
Equivalence to Turing Machines
- For any recursively-enumerable language , there exists an unrestricted grammar generating .
- For any unrestricted grammar , there exists a Turing machine accepting the same language.
Unrestricted grammars generate exactly the recursively-enumerable languages.
Example
The language is not context-free but is generated by an unrestricted grammar. The grammar uses non-terminals to enforce equal counts across 3 symbol types by rewriting across the string.
A simpler example: (strings that are the concatenation of a word with itself).
Productions (sketch):
- — separate the 2 halves
- — generate first half
- — generate second half
- Synchronization rules force and to produce the same string
Full grammars for such languages use auxiliary non-terminals and cross-symbol rewriting that no CFG production can simulate.