flac-hw7

# flac-hw7 - <if stmt> | <if stmt> else...

This preview shows pages 1–2. Sign up to view the full content.

FLAC Assignment 7 Exercise 1 Give a Turing machine with at most 12 states that doubles a number in unary representation. You will lose points if you use extra states. It should be clear your solution is correct; give explanation if necessary. Exercise 2 (a) Convert the following CFG into Chomsky Normal Form. Write down your steps. S a A a | b B b | ± A C | a B C | b C CDA | ± D A | B | ab (b) Use Younger’s Algorithm to to decide whether “ababa” is in the language. Write down the steps. Exercise 3 We already know { a n b n c n | n 0 } is not a context free language. Give a Turing machine that decides this language. Page 1

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

View Full Document
Exercise 4 We know following grammar is ambiguous. Please give some string in the language and show such that it has two diﬀerent parse trees. Here, <stmt> is the start symbol and terminals are: else, basic stmt, for clause, if, boolexpr, then, blk, compound. <stmt> <uncond stmt> | <cond stmt> <uncond stmt> basic-stmt | <for stmt> | blk | compound <for stmt> for clause <stmt> <cond stmt>
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: <if stmt> | <if stmt> else <stmt> <if stmt> → <if clause> <uncond stmt> <if clause> → if boolexpr then Exercise 5 In class we introduced a type of Turing Machine whose tape is two-way inﬁnite, which means the machine can keep moving left or right indeﬁnitely. Also the action that the machine can take is one of { L,R,N } . In the book, the deﬁnition is slightly diﬀerent. The tape of the Turing Machine is one-way inﬁnite, which means there is a leftmost square of the tape and the machine cannot move left when at that position. In addition, the action the machine can take is one of { L,R } . You task is to prove that a Turing Machine of the type deﬁned in the textbook can simulate a Turing Machine of the type deﬁned in class. Exercise 6 (Bonus) Prove that any context-free language over alphabet size 1, for example Σ = { 1 } , is also regular language. Page 2...
View Full Document

## This note was uploaded on 02/29/2012 for the course CS 15-453 taught by Professor Edmundm.clarke during the Spring '09 term at Carnegie Mellon.

### Page1 / 2

flac-hw7 - <if stmt> | <if stmt> else...

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

View Full Document
Ask a homework question - tutors are online