LR ( k ) grammar

from Wikipedia, the free encyclopedia

In theoretical computer science and compiler construction , LR ( k ) grammar refers to a special context-free grammar that forms the basis of an LR parser .

A context-free grammar is called a grammar if each reduction step is clearly defined by symbols of the input (so-called lookahead). This means that the question of which non-terminal symbol should be reduced to which rule with which rule can be clearly determined with the help of the next symbols in the input.

A difference in the language class that can be described with grammars can only be seen for the two cases and . The expressiveness of context-free grammars is not achieved by. This means that there are context-free grammars for everyone , for which there are no equivalent grammars , for example an inherently ambiguous language . The language class defined by grammars is also called deterministically context-free languages .

(DPDA = Deterministic Push-Down Automaton, PDA = Push-Down Automaton )

Formal definition of LR (k) grammar

A context-free grammar is grammar if and only if for all legal reductions of the form

with and applies:

, as well

See also

Web links