homework4

homework4 - the stack. The PDA will then test at the end of...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework #4 Solutions. 2.5 a. b. c. d.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
e. f. 2.6 b Three cases, more a’s than b’s, more b’s than a’s, and some a after some b are all in this language. These descriptions overlap, creating an ambiguous language. A Æ B| D | F B Æ C b C a C C Æ aC | bC | ε D Æ E a E E Æ EE | aEb | bEa | a | ε F Æ G b G G Æ GG | aGb | bGa | b | ε
Background image of page 2
d. Will come out later today. 2.7 b From a single start state, run an epsilon transition to two options. The case for a “b” somewhere before an “a” is easily solved in classic FSA notation, looping through some number of a’s, then transitioning to another state on a b, and lastly an accepting state on receiving another “a”. The other “counting” case will push onto the stack an “a” if there isn’t a “b” on the top of the stack, in which case it will instead pop that “b”. Likewise, it will push a “b” on top of the stack if there isn’t an “a”, otherwise popping said “a” from
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: the stack. The PDA will then test at the end of the input if the stack is not empty ($) and will accept. 2.7 d Will also come out later today 2.14 A BAB | B | B 00 | Add a new start state S A A BAB | B | B 00 | Remove A S A | A BAB | B B 00 | Remove B S A | A BAB | AB | BA | B B 00 Remove A B S A | A BAB | AB | BA | 00 B 00 Convert to proper form S A | A BC | AB | BA | B B 00 C AB 2.27 a. If condition then <STMT> else <STMT> <ASSIGN> if condition then if condition then A:= 1 else A:= 1 <ASSIGN> <STMT> <STMT> <STMT> If condition then <STMT> <STMT> <ASSIGN> <ASSIGN> <STMT> <STMT> If condition then <STMT> <STMT> If condition then <STMT> else <STMT> <STMT> b. Stmt <Assign> | <MIF> | <UIF> MIF if condition then <MIF> else <MIF> | Stmt UIF if condition then <Stmt> | if condition then <MIF> else <UIF> Assign A := 1...
View Full Document

Page1 / 4

homework4 - the stack. The PDA will then test at the end of...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online