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:

[edit] Examples

[edit] Example 1

S \to aSSb | c

precedence table:

S a b c $
S \dot = \lessdot \dot = \lessdot
a \dot = \lessdot \lessdot
b \gtrdot \gtrdot \gtrdot
c \gtrdot \gtrdot \gtrdot \gtrdot
$ \lessdot \lessdot


Languages