Assignment 3
Assignment 3
TOTAL MARKS: 82
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Instructions
• You are free to consult each other for verbal help. However, copying or sharing the soft/hard copy with each
other will not only result into the cancellation of the current assignment, but it may also impact your grade
in all the future assignments and exams as well.
• List your collaborators on the last page of your assignment. Collaborators are any people you discussed this
assignment with. This is an individual assignment, so be aware of the course's collaboration policy.
• You must attach this assignment at the top of your solution.
Tasks
Solve the following problems. The solutions may or may not be available online. If they are available, try to understand
them before re-phrasing them in your own words.
Task 1: Construct the context-free grammar for each of the following languages. (30 Marks)
S → aX
X → aX | bX | Λ
Task 3: Show that the following CFGs are ambiguous by finding a word with two distinct syntax trees.
1. S → SaSaS | b (5 Marks)
2. S → aSb | Sb | Sa | a (5 Marks)
Task 4: Using the algorithm of Kleene’s theorem, Part 3, Rule 2, construct FAs for the following languages
FA1 FA2
FL&TA CS224 PAGE 2
Task 5: Consider the following CFG and prove that this generates the language defined by the regular expression a* bb (5
Marks)
S → aS | bb