CSC 533: Organization of Programming Languages
HW2: EBNF Grammar
The following questions all refer to the EBNF of Modula-2.
- Which of the following are legal numbers in Modula-2?
For each legal number, provide a parse tree (with the
<number> abstraction at the root).
00 -2.9 C 3AH
2E-4 0.01E12 5.5E+5.5
- Describe, in concise English, the format for identifiers
(<ident>) in Modula-2. That is, what
characters may be used? What restrictions (if any) are there on order?
- What is the shortest possible subroutine
(<procedure_declaration>) in Modula-2? Justify your
- What is the order of precedence for the operators +, and
* in Modula-2? Justify your answer by providing the parse tree
for the <expression>: 1+2*3.
- Does the dangling-else problem apply to Modula-2? Justify your