Interesting languages
“Hardest” languages to test parsers. Most examples taken from Expressive power of LL(k) Boolean grammars ↗
TODO:
- add examples from The computational power of Parsing Expression Grammars ↗
LR(0)
on the other hand is regular, but not LR(0)
Linear context-free language
“Balanced brackets”:
And variations of the above:
Classical context sensitive (LinConjLL)
Classical context sensitive example:
S → A&CA → aA | DD → bDc | εC → aCc | BB → bB | ε
Context-sensitive, Indexed
S → ACaBCa → aaCCB → DB|EaD → DaAD → ACaE → EaAE → ε
“copy langauge”:
Context-sensitive, not indexed
From: R.H. Gilman, A shrinking lemma for indexed languages. Theoret. Comput. Sci. 163 (1996) 277–281
PEG
Same example used by Ford ↗ to show that PEG can handle context sensitive grammar.
A ← aAb/εB ← bBc/εS ← &(A!b)a∗ B!.
Actually it can’t handle exactly this language, but it still can handle other context sensitive language. See https://github.com/SRI-CSL/PVSPackrat/issues/3 ↗
Other context sensitive
TAG (Tree Adjoining Grammar)
MG (Minimalist Grammar)
CFLL, but not in LinCFLL
S → X &¬TT → X &¬Aca&¬AcbA → aAb | εX → aX | bX | cX | ε.
Strongly non-left-recursive Boolean P-complete language
S → E&¬AbS&¬CSA → aA | εC → aCAb | bE → aE | bE | ε.
Strongly non-left-recursive conjunctive language
S → C &DC → XCX | cX → a | bD → aA&aD | bB&bD | cEA → XAX | cEaB → XBX | cEbE → aE | bE | ε.
Jeż language
A1 → A1 A3 & A2 A2 | aA2 → A1 A1 & A2 A6 | aaA3 → A1 A2 & A6 A6 | aaaA6 → A1 A2 & A3 A3.
LL(1) linear Boolean language
S → aS&¬A | bBA → aAb | εB → bB | ε