previous up next
Go backward to Example
Go up to Top
Go forward to Semantics
RISC-Linz logo

Ambiguous Syntax Definitions

Expression 4*2+1 has two derivation trees!

Unambiguous definition

<expression > ::=
    <expression ><lowop > <term > |
    <term >
<term > ::= <term > <highop > <factor > | <factor >
<factor > ::= <numeral > | ( <expression > )
<lowop > ::= + | -
<highop > ::= * | /

Extra level of structure makes derivation unique but syntax complicated.


Author: Wolfgang Schreiner
Last Modification: October 13, 1997

previous up next