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 = * Sum = {}-{} Legal Statement – Sum = (1*2) – (2*3) Illegal Statement – Sum = (1*4)-(2*3) WHY IS THE ABOVE STATEMENT ILLEGAL? _______________________
Activity 1 = a|b|c|….x|y|z = 0|1|2|3|…8|9 = +|-|>|=|>=|<= <Statement> = {[]|[]|[]} = 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.