CS 1104 Introduction to Computer Science

COMPILERS AND TRANSLATORS

Syntactic Ambiguity

In some instances while a syntax may correctly produce the appropriate "program", the same syntax may be ambiguous when undertaking analysis.

Definition:
A syntax is said to be ambiguous when the same string can be generated through two different sequences of substitution.

EXAMPLE:

Consider a syntactic specification for an integer:

<integer> ::= <digit> | <integer> <integer>

Analysis will show that there are two possible trees for any string of length more than two digits:

 

 

[TOC]

Last updated 2001/03/13
© J.A.N. Lee, 2000-2001.