Simple precedence grammar
From Wikipedia, the free encyclopedia
A simple precedence grammar is a context-free formal grammar that can be parsed with a simple precedence parser.
Contents |
[edit] Formal definition
G = (N, Σ, P, S) is a simple precedence grammar if all the production rules in P comply with the following constraints:
- There are no erasing rules (ε-productions)
- There are no useless rules (unreacheable symbols or unproductives rules)
- For each pair of symbols X, Y (X, Y
(N ∪ Σ)) there is only one Wirth-Weber precedence relation. - G is uniquely inversible
[edit] Examples
[edit] Example 1

precedence table:
| S | a | b | c | $ | |
| S | ![]() |
![]() |
![]() |
![]() |
|
| a | ![]() |
![]() |
![]() |
||
| b | ![]() |
![]() |
![]() |
||
| c | ![]() |
![]() |
![]() |
![]() |
|
| $ | ![]() |
![]() |




