Programming Assignments using JFLAP
DUE Thursday, December 6 th
1. Build Finite State Automata using JFLAP to accept the following languages:
The alphabet is {a, b}
a) Odd number of a's
b) Odd number of a's and even number of b's
c) Odd number of a's and at least three b's
d) Number of a's and b's are both either even or they are both odd.
---------------------------------------------
2.
The college student Carl S .Student wants his parents to buy him a
car. His father produces a " transcripts string" of all the grades Carl
has ever received in his entire life an arbitrarily long single string
made up of symbols from { a, b, c, d, e, f} in no particular order .An
a is a high grade and an f is failure . His father produces a simple
criterion: if Carl received fewer than four d grades, he shall get a car,
otherwise he shall not. An f grade counts as single d grade.
His father asks you to design a right -linear grammar where the grammar
generates the transcript string if and only if Carl gets the car. Hint:
You an check if a Right-linear grammar generates a string with a Brute
-force parser, or by converting a grammar with a FA and checking if the
FA accepts the string.
(a) Design a Right-linear grammar with the above specifications.
(b) Carls intial reaction to this was to provide a succinct , heartfelt
plea for his father to adopt less draconian methods, indirectly appealing
to notion that the alienating presence of generational gap between father
and son may lead to father to be unduly harsh. Specifically "Mellow out,
old dude" The father then decides to make an f grade count as 2 d
grades. Adopt the grammar accordingly.
3.
Build and test a NPDA to accept the following languages.
{ a^n b^m | n>0 and n = m}