In the first half of the semester, you will be developing an interpreter for a simple scripting language named SILLY (Simple, Interpreted, Limited Language for You). The EBNF grammar rules for SILLY v. 22 are as follows:
Recall that | denotes alternatives within a rule, [ ] denotes an optional (0 or 1) element, and { } denotes a repetitive (0 or arbitrarily many) element. There is no whitespace (i.e., spaces, tabs or new lines) between the characters in an identifier, integer, or string. Otherwise, whitespace may appear between tokens but is not required.
Answer the following questions about the syntax of SILLY based on the above grammar rules.
id abstraction at the root). If invalid, briefly describe what aspect violates the rules.
Q abc 4b a1b23 123 X_1
expr abstraction at the root). If invalid, briefly describe what aspect violates the rules.
4 (4) -4 x + 1 (x + 1) 1+(2*a)
((2*a)+1) flag (not true) (not (true)) (not (not true))
(not true or false) (3 + 4 * 5) (8 / 4 / 2)
output abstraction at the root). If invalid, briefly describe what aspect violates the rules.
output "foo" output 1+2 output (1+2)
output ( ) output { } output { 1, a, true }
if abstraction at the root). If invalid, briefly describe what aspect violates the rules.
if true then if true then if (a > b) then { if (avg >= 80) then {
noelse { } max = a if (avg >= 90) then {
noelse } output "A"
else { }
max = b } else {
} output "B"
}
while) that is as short as
possible, in terms of number of tokens (where keywords such as while and do each count as only one token).subdecl) that is as short as
possible, in terms of number of tokens (where keywords such as sub and ( each count as only one token).subcall) that is as short as
possible, in terms of number of tokens (where keywords such as call and ( each count as only one token).