0% found this document useful (0 votes)
91 views

Tcs Assignment2

This document provides 8 problems related to formal language theory and automata. It asks the student to: 1) Describe the Chomsky hierarchy of languages and provide examples of each type of grammar. 2) Design a finite automaton and regular expression for a sample regular grammar. 3) Derive strings from a context-free grammar and draw derivation trees. 4) Analyze sample pushdown automata (PDA) including their state diagrams, computations, and languages accepted. 5) Build PDAs to accept specific languages. 6) Analyze a grammar, design a PDA, and write a regular expression for its language. 7) Trace computations and analyze a Turing machine's state diagram

Uploaded by

Afa Stars
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
91 views

Tcs Assignment2

This document provides 8 problems related to formal language theory and automata. It asks the student to: 1) Describe the Chomsky hierarchy of languages and provide examples of each type of grammar. 2) Design a finite automaton and regular expression for a sample regular grammar. 3) Derive strings from a context-free grammar and draw derivation trees. 4) Analyze sample pushdown automata (PDA) including their state diagrams, computations, and languages accepted. 5) Build PDAs to accept specific languages. 6) Analyze a grammar, design a PDA, and write a regular expression for its language. 7) Trace computations and analyze a Turing machine's state diagram

Uploaded by

Afa Stars
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

SCJ3203/SCK3253: Theory of Computer Science Assignment 2 This is an individual assignment.

Due date: 16th April, 2011


1. For each type of language in the Chomsky Hierarchy listed below, describe the form of rules that the grammar can have, give example of the rules; and state the simplest automaton/machine that can recognize the language: a. b. c. d. Type 0 unrestricted grammar Type 1 context sensitive grammar Type 2 context free grammar Type 3 unrestricted grammar

2. Consider the following regular grammar G: S bA A aC bB B bA C aD D aC a. Design a finite automaton to accept the language as described by grammar G. b. Give a regular expression for the language. 3. Let G2 be the grammar: S Ac A aAb | a. b. c. Derive a number of valid strings starting with string of shortest length. Stop when you can figure up the pattern of the strings. Draw the derivation tree for strings derived in 2a. Give a regular expression for the language.

4. Let M be the PDA defined by: Q = {q0, q1} = {a, b, c} = {A, B} F = { q2} Start state is q0 (q0, a, ) = {[q0, A]} (q0, b, AAA) = {[q1, ]} (q1, b, AAA) = {[q1, ]} (q1, c, ) = {[q2, ]}

a. Give the state diagram of M. b. Trace all computations of strings aabc, aaabbc, aaaabbc in M. c. Describe the language accepted by M. d. Give a regular expression for the language. 1

5. Build a PDA to accept the following languages: a. { anban | n 0} b. { anbmcn+m | n,m > 0}

6. Let G2 be the GNF grammar: S aABA | aBB A bA | b B cB | c a. Write the definition of the machine PDA that accept L(G2). b. Give the state diagram of the PDA. c. Give a regular expression for the language. 7. Let M be the Turing Machine defined by B a b q0 q1, B, R q1 q2 a. b. c. d. q1, B, R q1, a, R q2, b, L q1, b, R q2, a, L

c q2, c, L

Trace the computation for the input string abcab. Trace the first six transitions of the computation for the input string abab. Give the state diagram of M. Describe the result of a computation in M.

8. L is a language over alphabet {a, b, c} expressed by (a+b)*aac(a+b+c)* a. b. c. d. Design a Turing machine M for the language above. Write the transition function for M. Trace the string abaacbc and state whether it is accepted or rejected. Trace the string abcaacb and state whether it is accepted or rejected.

You might also like