You are on page 1of 1

Software Design & Development

SYNTAX DIAGRAMS

 They are used to describe the rules of programming languages.


 There are THREE major ways of representing them:
1. BNF
2. EBNF
3. Railroad Diagrams

How Do They Work?


Digit = 1 | 2| 3
Number = <Digit> * <Digit>
Sum = {<Number>}-{<Number>}

Legal Statement – Sum = (1*2) – (2*3)


Illegal Statement – Sum = (1*4)-(2*3)

WHY IS THE ABOVE STATEMENT ILLEGAL?


_______________________

Activity 1

<Letter> = a|b|c|….x|y|z
<Number> = 0|1|2|3|…8|9
<Operator> = +|-|>|=|>=|<=
<Statement> = {[<Operator>]|[<Letter>]|[<Number>]}
<Binary_Selection> = IF<Statement>THEN<Statement>ELSE<Statement>

1. Draw a railroad diagram for the above EBNF Statement.

2. Create a railroad diagram for multi-way selection structure.

You might also like