Todos los libros

Profesional

Apps Acerca de Coach Iniciar sesión Empezar a leer

Computer Science · Glosario

¿Qué es Ambiguous grammar, weak equivalence?

También llamado: ambiguous grammar · weak equivalence (grammars)

Definition 23.6 University Computer Science — Year 2 · Capítulo 23 — Context-Free Grammars and Pushdown Automata

A grammar is ambiguous if some word has two different parse trees. Two grammars are weakly equivalent if they generate the same language, whatever trees they give.

Two parse trees of a + a * a in the grammar E E + E E * E (E) a. Left: a + (a * a); right: (a + a) * a. Two parse trees of a + a * a in the grammar E E + E E * E (E) a. Left: a + (a * a); right: (a + a) * a.
Two parse trees of a+a∗aa + a * a in the grammar E→E+E∣E∗E∣(E)∣aE \to E + E \mid E * E \mid (E) \mid a. Left: a+(a∗a)a + (a * a); right: (a+a)∗a(a + a) * a.
The dangling else: in iixex, the else belongs to the inner if (left) or to the outer one (right). The dangling else: in iixex, the else belongs to the inner if (left) or to the outer one (right).
The dangling else: in iixexiixex, the else belongs to the inner if (left) or to the outer one (right).
Leer en el capítulo →