Download Geschichte der Programmiersprachen - Friedrich

Transcript
Extended Backus-Naur Form: Details
• Recursive BNF rules are often used to define repetition of substructures:
– <arithmetic expression> ::= <term>
| <arithmetic expression> <adding operator> <term>
– replaced by:
<arithmetic expression> ::=
<term> { <adding operator> <term> }∗
• Disadvantage: obscures left-associativity of operators.
• Alternatives are often used to define optional substructures:
– <if statement> ::= if <condition> then <statement>
| if <condition> then <statement> else <statement>
– replaced by:
<if statement> ::=
if <condition> then <statement> [ else <statement> ]
Geschichte der Programmiersprachen
6.15