Theory of Programming Languages
Theory of Programming Languages
Page 1 of 2
Question 2 - SN
SN is a language of all the quaternary numbers which contain no
leading zeros (except for the lone digit 0) composed only of the digits 0,
1, 2, 3 . The numbers also cannot have two of the same digits adjacent
to another.
SN examples
●0
● 102030201
● 102323232301010
● 12321
SN non-examples
● 0123123123
● 11
● 12301233
● 1234
Task 1 - write a BNF grammar description of SN [18]
Task 2 - Draw a parse tree for 0 [1]
Task 3 - Draw a parse tree for 132 [5]
Task 4 - Explain why a parse tree cannot be drawn for 1223 [5]
Question 3 [6]
Explain BNF in natural language as if you were trying to teach a
freshman computer science student.
Page 2 of 2