0% found this document useful (0 votes)
3 views2 pages

Theory of Programming Languages

Assignment

Uploaded by

AY S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Theory of Programming Languages

Assignment

Uploaded by

AY S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment 04 (BCS-5) – CLO-3

Deadline: 17-12-2024, Total Marks : 50


Note: Only handwritten submissions are acceptable having neat and clean handwriting within
deadline.

Question 1: BCS5-TPL is a language consisting of the set of all strings


composed of a number of strings (listed below) in parentheses ending
in either ( - ) or ( . + ).
Strings options
●(-)
●(--)
●(-..)
●(.-.)
●(..-)
●(.+)
Several examples of sentences in BCS5-TPL are
●(-)
● ( . + )( - - )( . + )
● ( - )( - )( - )( . + )
Task 1 - write a BNF grammar description of BCS5-TPL [11]
Task 2 - Draw a parse tree for ( - ) [2]
Task 3 - draw a parse tree for ( . . - )( . . - )( . + )( . - . )( . + ) [6]

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

You might also like