ambiguous grammar

Related Overviews


'ambiguous grammar' can also refer to...


More Like This

Show all results sharing this subject:

  • Computing


Show Summary Details

Quick Reference

A context-free grammar that derives the same word by different derivation trees, or equivalently by different derivation sequences. A familiar programming language example is:

S → if C then S else S

S → if C then S

where S and C stand for statement and condition. This grammar is ambiguous since the following compound statement

if c1 then if c2 then s2 else s1

has two interpretations, corresponding with two derivation trees, as shown in the diagram. See also inherently ambiguous language.

Ambiguous grammar. Two derivation trees in an ambiguous grammar

Subjects: Computing.

Reference entries

Users without a subscription are not able to see the full content. Please, subscribe or login to access all content.