UNIT 1 SNS COLLEGE OF ENGINEERING

Size: px
Start display at page:

Download "UNIT 1 SNS COLLEGE OF ENGINEERING"

Transcription

1 1 SNS COLLEGE OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING THEORY OF COMPUTATION TWO MARKS WITH ANSWERS UNIT 1 1. Define set. A set is a collection of objects. E.g.: The collection of the four letters. S={ a,b,c,d} 2. Define function. A function is a rule that assigns to elements of one set a unique element of another set. 3. Define relation. A relation is a set of pairs. The first component of each pair is chosen from a set called the domain and second component of each pair is chosen from a set called the range. 4. Give the examples/applications designed as finite state system. Text editors and lexical analyzers are designed as finite state systems. A lexical analyzer scans the symbols of a program to locate strings corresponding to identifiers, constants etc, and it has to remember limited amount of information. 5. Define alphabet. A finite set of non-empty set of symbols is called alphabet. 6. What do you mean by string? A finite sequence of symbols is called string. 7. Define language. The language can be defined as a collection of strings or words over certain input set. 8. Define Abstract machines with e.g. The computer which performs computation are not actual computers they are abstract machine. E.g.: Finite Automata, Push down automata and Turing machine. 10. Define Finite Automaton (FA) FA consists of a finite set of states and a set of transitions from state to state that occur on input symbols chosen from an alphabet _. Finite Automata is denoted by a 5- tuples (Q,, δ,q0,f), where Q is the finite set of states, _ is a finite input alphabet, q0 in Q is the initial state, F is the set of final states and _ is the transition mapping function Q * to Q. 11. Define DFA. A DFA consists of A=( Q,, δ,q0,f) Where Q is the finite set of states, is a finite input alphabet, q0 in Q is the initial state, F is the set of final states and δ is the transition mapping function Q * to Q. 12. Define NFA A NFA consists of A=( Q,, δ,q0,f) Where Q is the finite set of states, is a finite input alphabet, q0 in Q is the initial state, F is the set of final states and δ is the transition mapping function δ : Q x ( U{ ε }) = 2Q

2 2 13. Define Transition diagram Transition diagram is a directed graph in which the vertices of the graph correspond to the states of FA. If there is a transition from state q to state p on input a, then there is an arc labeled a from q to p in the transition diagram. 14. What are the applications of automata theory? In compiler construction. In switching theory and design of digital circuits. To verify the correctness of a program. Design and analysis of complex software and hardware systems. To design finite state machines such as Moore and mealy machines. 15. What are the components of Finite automaton model? The components of FA model are Input tape, Read control and finite control. (a)the input tape is divided into number of cells. Each cell can hold one i/p symbol. (b)the read head reads one symbol at a time and moves ahead. (c)finite control acts like a CPU. Depending on the current state and input symbol read from the input tape it changes state. 16. Differentiate NFA and DFA. NFA or Non Deterministic Finite Automaton is the one in which there exists Many paths for a specific input from current state to next state. NFA can be used in theory of computation because they are more flexible and easier to use than DFA. Deterministic Finite Automaton is a FA in which there is only one path for a specific input from current state to next state. There is a unique transition on each input symbol 17. What is -closure of a state q0? -closure (q0) denotes a set of all vertices p such that there is a path from q0 to labeled. 18. What is a Regular Language? The language accepted by M is L(M) is the set {x δ (q0,x) is in F}. A language is regular if it is accepted by some finite automaton. 19. Define star closure and positive closure. Star closure zero or more. Occurrence Positive closure one or more occurrence (eg) a* = { ε,a,aa,.} a+ = {a,aa,.} L+ = L* - { ε } 20. Define NFA with _-transition. Is the NFA s with ε -transitions are more powerful that the NFA s without ε -transition? The NFA with - moves defined by 5 tuples or quintyple as similarly as NFA, except δ (Q,,δ,qo,F) with all components as before and δ: Qx( U{ ε}) = 2Q No, NFA with ε -transition and NFA without ε -transition have the same power. 21. Define Finite State Systems The finite automaton is a mathematical model of a system, with discrete inputs and outputs and a finite number of memory configuration called states. 22. Is it true the language accepted by NFA is different from the regular language? Justify. Your answer. No, it is false. For every regular expression r there exists a NFA with _- transition that accepts L(r).

3 3 UNIT-II 1. What is a regular expression? A regular expression is a string that describes the whole set of strings according to certain syntax rules. These expressions are used by many text editors and utilities to search bodies of text for certain patterns etc. Definition is: Let _ be an alphabet. The regular expression over _ and the sets they denote are: i. Φ is a r.e and denotes empty set. ii. is a r.e and denotes the set { } iii. For each a in, a+ is a r.e and denotes the set {a}. iv. If r and s are r.e denoting the languages R and S respectively then (r+s),(rs) and (r*) are r.e that denote the sets RUS, RS and R* respectively 2. List out the operator of regular expression. Union of two Languages Concatenation of two Languages Closure of a Language 3. Write a r.e to denote a language L which accepts all the strings which begin or end with either 00 or 11. The r.e consists of two parts: L1= (00+11) (any no of 0 s and 1 s) = (00+11) (0+1)* L2= (any no of 0 s and 1 s)(00+11) = (0+1)*(00+11) Hence r.e R=L1+L2 = [(00+11)(0+1)*] + [(0+1)* (00+11)] 4. Construct a r.e for the language which accepts all strings with atleast two c s over the set ={c,b} (b+c)* c (b+c)* c (b+c)* 5.Construct a r.e for the language over the set _={a,b} in which total number of a s are divisible by 3 ( b* a b* a b* a b*)* 6. what is: (i) (0+1)* (ii)(01)* (iii)(0+1) (iv)(0+1)+ (0+1)*= {, 0, 1, 01, 10,001,101,101001, } Any combinations of 0 s and 1 s. (01)*= {, 01,0101,010101,..} All combinations with the pattern 01. (0+1) = 0 or 1,No other possibilities. (0+1)+ = {0,1,01,10,1000,0101,.} 7.Reg exp denoting a language over ={1} having (i) even length of string (ii) odd length of a string (i) Even length of string R=(11)* (ii) Odd length of the string R=1(11)* 8.Reg exp for: (i)all strings over {0,1} with the substring 0101 (ii)all strings beginning with 11 and ending with ab (iii)set of all strings over {a,b}with 3 consecutive b s. (iv)set of all strings that end with 1 and has no substring 00 (i) (0+1)* 0101(0+1)* (ii) 11(1+a+b)* ab (iii) (a+b)* bbb (a+b)* (iv) (1+01)* (10+11)* 1 9. Reg exp for the language that accepts all strings in which a appears tripled over the set ={a} reg exp=(aaa)* 10. What is the closure property of regular sets? The regular sets are closed under union, concatenation and Kleene closure. r1ur2= r1 +r2 ; r1.r2= r1r2 ; ( r )*=r* The class of regular sets are closed under complementation, substitution, homomorphism and inverse homomorphism. 11. Write the exp for the language starting with and has no consecutive b s

4 4 reg exp=(a+ab)* 12. What is the order of precedence of operators used in regular expression? i. Operator is having the highest precedence. ii. Next the concatenation or dot operator (.). iii. + Operator is having the lowest precedence. 13. Describe the algebra of regular expression. Regular expressions obey many laws of arithmetic. a. Union and Concatenation are associative. b. Union is commutative. c. Union is idempotent. 14. Define pumping lemma for regular languages. Let L be a regular language. Then there exists a constant n such that for every string w in L such that w n. w = xyz such that a. y. b. xy n. c. For all i 0, xy i z L. 15. How do you test the emptiness of regular language? The emptiness is defined by checking whether there is a path from the start sate to some accepting state. If there is a path available the languages nonempty. If the accepting states are separated from the start state then the language is empty. 16 Write the formula for convert DFA to RE (Regular expression). Rij (k) = Rij(k-1)+Rik(k-1) ( Rkk(k-1))*Rkj(k-1) 17. List the application of regular expression. a. Regular expression in UNIX b. Lexical Analysis. c. Finding Patterns in a Text 18. What do you mean by equivalence and minimization of DFA? For each DFA it is possible to find an equivalent DFA which contains as few s states as any DFA accepting the same language. UNIT-III 1. What are the applications of pumping lemma? Pumping lemma is used to check if a language is regular or not. (i) Assume that the language (L) is regular. (ii) Select a constant n. (iii) Select a string (z) in L, such that z >n. (iv) Split the word z into u,v and w such that uv <=n and v >=1. (v) You achieve a contradiction to pumping lemma that there exists an 2. What are the applications of Regular expressions? Lexical analyzers and Text editors are two applications. Lexical analyzers: The tokens of the programming language can be expressed using regular expressions. The lexical analyzer scans the input program and separates the tokens. For eg identifier can be expressed as a regular expression as: (letter)(letter+digit)* If anything in the source language matches with this reg exp then it is Recognized as an identifier. The letter is{a,b,c,..z,a,b,c.z} and digit is {0,1, 9}.Thus reg exp identifies token in a language. Text editors: These are programs used for processing the text. For example UNIX text editors uses the reg exp for substituting the strings such as: S/bbb*/b/ 3. What are the applications of Finite automata? Gives the substitute a single blank for the first string of two or more blanks in a given line. In UNIX text editors any reg exp is converted to an NFA with ε- transitions, this NFA can be then simulated directly 4. What is Arden s Theorem? Arden s theorem helps in checking the equivalence of two regular expressions.

5 5 Let P and Q be the two regular expressions over the input alphabet _. The regular expression R is given as :R=Q+RP Which has a unique solution as R=QP*. 5. Define Homomorphisms. A string homomorphism is a function on string that works by substituting a particular string for each symbol. 6.. Define Inverse Homomorphisms Homomorphisms may also be applied backwards and this mode they also preserve regular language. 7. What are the closure properties of regular languages? i. Union ii. Intersection iii. Complement iv. Difference v. Reversal vi. Closure. vii. Concatenation. viii. Homomorphism. ix. Inverse Homomorphism. UNIT-IV 1. Define a context free grammar A context free grammar (CFG) is denoted as G=(V,T,P,S) where V and T are finite set of variables and terminals respectively. V and T are disjoint. P is a finite set of productions each is of the form A-> _ where A is a variable and _ is a string of symbols from (V U T)*. 2. What are the uses of Context free grammars? Construction of compilers. Simplified the definition of programming languages. Describes the arithmetic expressions with arbitrary nesting of balanced parenthesis { (, ) }. Describes block structure in programming languages. Model neural nets. 3. The language generated by G ( L(G) ) is {w w is in T* and S =w }. That is a G String is in L(G) if: (1) The string consists solely of terminals. (2) The string can be derived from S. 4. What is (a) CFL (b) Sentential Form? L is a context free language (CFL) if it is L(G) for some CFG G. A string of terminals and variables _ is called a sentential form if: *S => _, where S is the start symbol of the grammar. 5. What is the language generated by the grammar G=(V,T,P,S) where P={S->aSb, S->ab}? S=> asb=>aasbb=>..=>anbn Thus the language L(G)={ anbn n>=1}.the language has strings with equal number of a s and b s. 6. If S->aSb aab, A->bAa, A->ba.Find out the CFL soln. S->aAb=>abab S->aSb=>a aab b =>a a ba b b(sub S->aAb) S->aSb =>a asb b =>a a aab b b=>a a a ba b bb Thus L={an bm am bn, where n,m>=1} 7. What is an ambiguous grammar? A grammar is said to be ambiguous if it has more than one derivation trees for a sentence or in other words if it has more than one leftmost derivation or more than one rightmost derivation. 8.Give the context free grammar for generating the ambiguous L={a n b 2n ;n_1} SSbb Sabb_

6 6 9. Consider G whose productions are SaAS_a, ASbA_SSba. Show that S=>aabbaa. S=>Aas =>asbas =>aabas =>aabbas =>aabbaa 10. Find the language generated by a CFG. G=({S},{0,1},{S0 1 _, S0S0 1S1 S) S =>0S0 S =>1S1 =>01S10 =>10S01 =>0I0I0 =>10001 L= { w;w is a palindrome} 11. Differentiate sentences Vs sentential forms A sentence is a string of terminal symbols. A sentential form is a string containing a mix of variables and terminal symbols or all variables. This is an intermediate form in doing a derivation. 12.Define Pushdown Automata. A pushdown Automata M is a system (Q, _, _, _,q0, Z0,F) where Q is a finite set of states. _ is an alphabet called the input alphabet. _ is an alphabet called stack alphabet. q0 in Q is called initial state. Zo in _ is start symbol in stack. F is the set of final states. _ is a mapping from Q X (_ U { _ } ) X _ to finite subsets of Q X _ *. 13. Compare NFA and PDA. NFA 1. The language accepted by NFA is the regular language. 2. NFA has no memory. 3. It can store only limited amount of information 4. A language/string is accepted only by reaching the final state. PDA 1.The language accepted by PDA is Context free language. 2. PDA is essentially an NFA with a stack(memory). 3 It stores unbounded limit of information. 4. It accepts a language either by empty Stack or by reaching a final state. 14. What are the different types of language acceptances by PDA and define them, Two types 1. Acceptance by final state 2. Acceptance by empty stack 15.Is it true that the language accepted by a PDA by empty stack and final states are different languages. No, because the languages accepted by PDA s by final state are exactly the languages accepted by PDA s by empty stack. 16. What is the additional feature of PDA has when compared with NFA? Is PDA superior over NFA? Is PDA superior over NFA in the sense of language acceptance? Justify your answer: Additional features of PDA: a) PDA is eventually a FA with a stack. b) PDA can accept context free languages. c) PDA can recognize the context free languages which are not regular. Yes, PDA is superior over NFA in the sense of languages. 17. Is it true the nondeterministic PDA is more powerful than that of deterministic PDA? justify your answer. Yes, wwr is accepted by NPDA but not any DPDA in the sense of language acceptance.

7 7 18. Regular Language: A Language can be described by DFA or NFA. Context free language cannot be described by DFA (or) NFA since there is no memory. Pushdown Automata has a memory, which can be used to count the number. Pushdown Automata can accept context free languages. It is essentially an NFA with a stack. 19. A pushdown automata G=(Q,,G,d,q0,z,F) is said to be deterministic if 1. d(q,a,b)contains almost one element. 2. If d(q,l,b) is not empty, then d(q,c,b) must be empty for overy c_, q_q, b_g The first condition says that for any given input symbol and any stack top, at most one move can be made. The second condition say that when a l move is possible for some configuration, no input consuming alternative is available 20. What are the properties of the CFL generated by a CFG? Each variable and each terminal of G appears in the derivation of some word in L There are no productions of the form A->B where A and B are variables. 21. Give examples of languages handled by PDA. (1) L={ anbn n>=0 },here n is unbounded, hence counting cannot be done by finite memory. So we require a PDA,a machine that can count without limit. (2) L= { wwr w {a,b}* }, to handle this language we need unlimited counting capability. 22 Is NPDA (Nondeterministic PDA) and DPDA (Deterministic PDA)equivalent? The languages accepted by NPDA and DPDA are not equivalent. For example: wwr is accepted by NPDA and not by any DPDA. 23. State the equivalence of acceptance by final state and empty stack. If L = L(M2) for some PDA M2, then L = N(M1) for some PDA M1. If L = N(M1) for some PDA M1,then L = L(M2) for some PDA M2. where L(M) = language accepted by PDA by reaching a final state. N(M) = language accepted by PDA by empty stack. 24. State the equivalence of PDA and CFL. If L is a context free language, then there exists a PDA M such that L=N(M). If L is N(M) for some PDA m, then L is a context free language. 25. Define Deterministic PDA. A PDA M =( Q, _, _, _,q0, Z0,F ) is deterministic if: For each q in Q and Z in _, whenever _ (q, _,Z) is nonempty,then _ (q,a,z) is empty for all a in _. For no q in Q, Z in _, and a in _ U { _} does _ (q,a,z) contains more than one element. (Eg): The PDA accepting {wcwr w in ( 0+1 ) * }. 26. State the equivalence of acceptance by final state and empty stack. If L = L(M2) for some PDA M2, then L = N(M1) for some PDA M1. If L = N(M1) for some PDA M1,then L = L(M2) for some PDA M2. where L(M) = language accepted by PDA by reaching a final state. N(M) = language accepted by PDA by empty stack. 27. What is the informal definition of PDA? A PDA is a computational machine to recognize a Context free language. Computational power of PDA is between Finite automaton and Turing machines. The PDA has a finite control, and the memory is organized as a stack. 28. Give an example of Nondeterministic CFL The language L={ wwr : w {a,b}+ } is a nondeterministic CFL.

8 8 UNIT-V 1. What is a formal language? Language is a set of valid strings from some alphabet. The set may be empty,finite or infinite. L(M) is the language defined by machine M and L( G) is the languagedefined by Context free grammar. The two notations for specifying formal languages are: Grammar or regular expression(generative approach) Automaton(Recognition approach) 2. What are all the normal forms for CFG? Normal forms for CFG are: i. Chomsky normal form. ii. Greiback normal form. 3. What are the three ways to simplify a context free grammar? By removing the useless symbols from the set of productions. By eliminating the empty productions. By eliminating the unit productions. 3.. What are the properties of the CFL generated by a CFG? Each variable and each terminal of G appears in the derivation of some word in L There are no productions of the form A->B where A and B are variables. 4. True or False (a)cfl are not closed under intersection and complementation True. (b)a regular grammar generates an empty string True. (c) A regular language is also context free but not reverse True. (d)a regular language can be generated by two or more different grammar True. (e) Finite State machine (FSM) can recognize only regular grammar-true. 5. What is Backus-Naur Form (BNF)? Computer scientists describes the programming languages by a notation called Backus-Naur Form. This is a context free grammar notation with minor changes in format and some shorthand. 6. What are the closure properties of CFL? CFL are closed under union, concatenation and Kleene closure. CFL are closed under substitution, homomorphism. CFL are not closed under intersection, complementation. Closure properties of CFL s are used to prove that certain languages are not Context free. 7. State the pumping lemma for CFLs. Let L be any CFL. Then there is a constant n, depending only on L, such that if z is in L and z >=n, then z=uvwxy such that : (i) vx >=1 (ii) vwx <=n and (iii) for all i>=0 uviwxiy is in L. 8. What is the main application of pumping lemma in CFLs? The pumping lemma can be used to prove a variety of languages are not context free. Some examples are: L1 ={ ai c i i>=1} is not a CFL. L2= { aibjcidj i>=1 and J>=1 } is not a CFL 9. Define Chomsky normal form. A grammar in which all productions are the form ABC or A_ where A,B and C are variables and a is a terminal. 10. Define Grieback normal form? A grammar for which every productions is of the form Aa_ where A is a variable, a is a terminal and _ is a string of variables. A language L is said to be deterministic context free language, if and only if there exists a deterministic pushdown automata (dpda) M such that L = L (M)

9 9 UNIVERSITY QUESTIONS : Year: NOV / DEC 2010 Two marks 1. Show that the statements p v q v r v s and (( p q) r) -> s are equivalent. 2. List all the properties of an equivalence relation. 3. Define Finite Automata. 4. Define Kleene star of a Language. 5. Let L { 0,1}* be the language of all strings of even length.(since 0 is even ξl). Is L regular? If it is, what is a regular expression corresponding to it? 6. let L= {0,11}.Find L 0,L Let L be the set of all strings over {0,1} of length 6 or less. Find out the regular expression corresponding to it. 8. Draw the NFA for (a b)* 9. state The Pumping Lemma for Regular Languages, 10. Explain how membership is tested in a regular language. 11. Explain how two states of a DFA distinguished. 12. What is the central idea behind the minimization of DFA? 13. What are parse trees? 14. When is a CFG said to be right linear? 15. What is a yield of a tree? 16. When is grammar said to be ambiguous? 17. What are the conditions to be satisfied by grammer in CNF? 18. prove the following theorem: if L is a CFL,then so is L R. 19. What is GNF? 20. Eliminate Unit production from the following grammer I -> a b Ia Ib I0 I1 F->I (E) T->F T*F E->T E+T Year: APRIL / MAY List the application of automata theory. 22. Differentiate NFA and DFA. 23. Differentiate L* and L Define ξ closure 25. state Arden s Theorem. 26. Construct a regular expression for the language over the set = (a,b) in which total number of a s are divisible by List the applications of regular expression. 28. Find out the language generated by the regular expression (0+1)* 29. What is the closure property of regular sets? 30. Mention the applications of pumping lemma 31. Is it true that the language accepted by any NFA is different from the regular language? Justify your answer. 32. Give a regular expression to describe an identifier and a positive integer. 33. When is a grammer said to be anbiduous? 34. Define instaneous description (ID) in PDA. 35. Specify the two types of moves in PDA. 36. Find L(G) where G= ({S},{0,1},{s->0S1,s->ξ},s) 37. State Chomsky Normal Forms. 38. Eliminate all unit productions:s->aa B;B->A bb;a->a bc B 39. What are the closure properties of CFL? 40. State the Pumping Lemma for CFLs.

10 10 Year: MAY / JUNE What is finite automata? 42. Give a DFA which accepts (a/b)*abb. 43. State the rules that define the regular expressions 44. give few algebraic laws that hold for arbitrary regular expressions r,s and t. 45. what does the statement that the regular languages are closed under complement mean? 46. Give formal statement of Pumping Lemma for a regular Language L. 47. Define Context-free grammer. 48. What is parsing? 49. state the properties of CFL. 50. Differentiate PDA from that of Finite State Machines. 5. Design a PDA to accept the set of all palindrome strings.trace it for the string aba. 6. Explian in detail Decision Properties of Regular Languages. 7. Explain in detail Closure Properties of CFL. 8. a) What is PDA?Write the steps ro convert a grammer to PDA b) Convert the following grammer to PDA I->a b Ia Ib I0 I E->I E*E E+E (E) 9. Construct an equivalent DFA for the following NFA Possible 8 Marks/12 Mark/18 Mark 1. Construct a minimized DFA for (a b)*abb 2. a) Design a CFG for the set {0 n 1 n n 1}. b) Construc the left most and right most derivation tress for the expression 0011 and Convert the following grammer to CNF S->AACD A->aAb ^ a->ac a D->aDa bdb ^ 4. Design a finite Automata accepting the following regular expressions a) (a+b)*(ab+bba) b) {0,1}*{10} 10. Construct the regular expression for the following DFA using Arden s method: M=(Q,,δ,q0,F) Where Q={q0,q1,q2}, ={0,1}, q0=q0,f=q2 δ 0 1 q0 q1 q1 q1 q2 q2 q2 q1 q1 11. a) Prove the equivalence of NFA and DFA. b)prove that if L is accepted bya DFA then L is denoted by a regular expression. 12. Construct a DFA equivalent to M = ({q0,q1,q2,q3},{a,b}, δ,q0,{q3}) Where δ (q0,a) = {q0,q1}; δ (q0,b) = {q0}; δ (q1,a) = {q2}; δ (q1,b) = {q1}; δ (q2,a) = {q3}; δ (q2,b) = {q3}; δ (q3,b) = {q2};

11 a) Show that the following grammer is ambiguous. S->aSbS bsas ξ b) Let G = { {S}, {a,b}, P, S} with P:{S->aSa;S->bSb;S->ξ} find the language generated by this grammer? 14. Convert the following CFG to GNF A1->A2A3; A2->A3A1 b; A3->A1A2 a 15. Obtain a PDA to accept the language L= (a n b 2n n>= 1} 16. obtain a CFG that generates the language accepted by PDA M = ( {q0,q1},{a,b},{a,z}, δ,q0,z,{q1}) with the transitions δ (q0,a,z) = {q0,az} δ (q0,b,a) = {q0,aa} δ (q0,a,a) = {q1,ε}

3 rd Year - Computer Science and Engineering,

3 rd Year - Computer Science and Engineering, DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 3 rd Year - Computer Science and Engineering, 5th Semester Theory of Computation QUESTION BANK 2 Marks Question and Answer 1. Define set. A set is a collection

More information

JNTUWORLD. Code No: R

JNTUWORLD. Code No: R Code No: R09220504 R09 SET-1 B.Tech II Year - II Semester Examinations, April-May, 2012 FORMAL LANGUAGES AND AUTOMATA THEORY (Computer Science and Engineering) Time: 3 hours Max. Marks: 75 Answer any five

More information

CT32 COMPUTER NETWORKS DEC 2015

CT32 COMPUTER NETWORKS DEC 2015 Q.2 a. Using the principle of mathematical induction, prove that (10 (2n-1) +1) is divisible by 11 for all n N (8) Let P(n): (10 (2n-1) +1) is divisible by 11 For n = 1, the given expression becomes (10

More information

R10 SET a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA?

R10 SET a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA? R1 SET - 1 1. a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA? 2. a) Design a DFA that accepts the language over = {, 1} of all strings that

More information

UNIT I PART A PART B

UNIT I PART A PART B OXFORD ENGINEERING COLLEGE (NAAC ACCREDITED WITH B GRADE) DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING LIST OF QUESTIONS YEAR/SEM: III/V STAFF NAME: Dr. Sangeetha Senthilkumar SUB.CODE: CS6503 SUB.NAME:

More information

QUESTION BANK. Formal Languages and Automata Theory(10CS56)

QUESTION BANK. Formal Languages and Automata Theory(10CS56) QUESTION BANK Formal Languages and Automata Theory(10CS56) Chapter 1 1. Define the following terms & explain with examples. i) Grammar ii) Language 2. Mention the difference between DFA, NFA and εnfa.

More information

Skyup's Media. PART-B 2) Construct a Mealy machine which is equivalent to the Moore machine given in table.

Skyup's Media. PART-B 2) Construct a Mealy machine which is equivalent to the Moore machine given in table. Code No: XXXXX JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY, HYDERABAD B.Tech II Year I Semester Examinations (Common to CSE and IT) Note: This question paper contains two parts A and B. Part A is compulsory

More information

(a) R=01[((10)*+111)*+0]*1 (b) ((01+10)*00)*. [8+8] 4. (a) Find the left most and right most derivations for the word abba in the grammar

(a) R=01[((10)*+111)*+0]*1 (b) ((01+10)*00)*. [8+8] 4. (a) Find the left most and right most derivations for the word abba in the grammar Code No: R05310501 Set No. 1 III B.Tech I Semester Regular Examinations, November 2008 FORMAL LANGUAGES AND AUTOMATA THEORY (Computer Science & Engineering) Time: 3 hours Max Marks: 80 Answer any FIVE

More information

VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur 603203. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Year & Semester : III Year, V Semester Section : CSE - 1 & 2 Subject Code : CS6503 Subject

More information

1. Which of the following regular expressions over {0, 1} denotes the set of all strings not containing 100 as a sub-string?

1. Which of the following regular expressions over {0, 1} denotes the set of all strings not containing 100 as a sub-string? Multiple choice type questions. Which of the following regular expressions over {, } denotes the set of all strings not containing as a sub-string? 2. DFA has a) *(*)* b) ** c) ** d) *(+)* a) single final

More information

Final Course Review. Reading: Chapters 1-9

Final Course Review. Reading: Chapters 1-9 Final Course Review Reading: Chapters 1-9 1 Objectives Introduce concepts in automata theory and theory of computation Identify different formal language classes and their relationships Design grammars

More information

Multiple Choice Questions

Multiple Choice Questions Techno India Batanagar Computer Science and Engineering Model Questions Subject Name: Formal Language and Automata Theory Subject Code: CS 402 Multiple Choice Questions 1. The basic limitation of an FSM

More information

CS210 THEORY OF COMPUTATION QUESTION BANK PART -A UNIT- I

CS210 THEORY OF COMPUTATION QUESTION BANK PART -A UNIT- I CS210 THEORY OF COMPUTATION QUESTION BANK PART -A UNIT- I 1) Is it true that the language accepted by any NDFA is different from the regular language? Justify your answer. 2) Describe the following sets

More information

CS402 Theory of Automata Solved Subjective From Midterm Papers. MIDTERM SPRING 2012 CS402 Theory of Automata

CS402 Theory of Automata Solved Subjective From Midterm Papers. MIDTERM SPRING 2012 CS402 Theory of Automata Solved Subjective From Midterm Papers Dec 07,2012 MC100401285 Moaaz.pk@gmail.com Mc100401285@gmail.com PSMD01 MIDTERM SPRING 2012 Q. Point of Kleen Theory. Answer:- (Page 25) 1. If a language can be accepted

More information

QUESTION BANK. Unit 1. Introduction to Finite Automata

QUESTION BANK. Unit 1. Introduction to Finite Automata QUESTION BANK Unit 1 Introduction to Finite Automata 1. Obtain DFAs to accept strings of a s and b s having exactly one a.(5m )(Jun-Jul 10) 2. Obtain a DFA to accept strings of a s and b s having even

More information

T.E. (Computer Engineering) (Semester I) Examination, 2013 THEORY OF COMPUTATION (2008 Course)

T.E. (Computer Engineering) (Semester I) Examination, 2013 THEORY OF COMPUTATION (2008 Course) *4459255* [4459] 255 Seat No. T.E. (Computer Engineering) (Semester I) Examination, 2013 THEY OF COMPUTATION (2008 Course) Time : 3 Hours Max. Marks : 100 Instructions : 1) Answers to the two Sections

More information

AUTOMATA THEORY AND COMPUTABILITY

AUTOMATA THEORY AND COMPUTABILITY AUTOMATA THEORY AND COMPUTABILITY QUESTION BANK Module 1 : Introduction to theory of computation and FSM Objective: Upon the completion of this chapter you will be able to Define Finite automata, Basic

More information

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CS6503 / THEORY OF COMPUTATION III YEAR / V SEM QUESTION BANK UNIT I AUTOMATA

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CS6503 / THEORY OF COMPUTATION III YEAR / V SEM QUESTION BANK UNIT I AUTOMATA DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CS6503 / THEORY OF COMPUTATION III YEAR / V SEM QUESTION BANK UNIT I AUTOMATA 1. Why are switching circuits called as finite state systems? A switching circuit

More information

Languages and Compilers

Languages and Compilers Principles of Software Engineering and Operational Systems Languages and Compilers SDAGE: Level I 2012-13 3. Formal Languages, Grammars and Automata Dr Valery Adzhiev vadzhiev@bournemouth.ac.uk Office:

More information

Ambiguous Grammars and Compactification

Ambiguous Grammars and Compactification Ambiguous Grammars and Compactification Mridul Aanjaneya Stanford University July 17, 2012 Mridul Aanjaneya Automata Theory 1/ 44 Midterm Review Mathematical Induction and Pigeonhole Principle Finite Automata

More information

Derivations of a CFG. MACM 300 Formal Languages and Automata. Context-free Grammars. Derivations and parse trees

Derivations of a CFG. MACM 300 Formal Languages and Automata. Context-free Grammars. Derivations and parse trees Derivations of a CFG MACM 300 Formal Languages and Automata Anoop Sarkar http://www.cs.sfu.ca/~anoop strings grow on trees strings grow on Noun strings grow Object strings Verb Object Noun Verb Object

More information

AUBER (Models of Computation, Languages and Automata) EXERCISES

AUBER (Models of Computation, Languages and Automata) EXERCISES AUBER (Models of Computation, Languages and Automata) EXERCISES Xavier Vera, 2002 Languages and alphabets 1.1 Let be an alphabet, and λ the empty string over. (i) Is λ in? (ii) Is it true that λλλ=λ? Is

More information

Compiler Construction

Compiler Construction Compiler Construction Exercises 1 Review of some Topics in Formal Languages 1. (a) Prove that two words x, y commute (i.e., satisfy xy = yx) if and only if there exists a word w such that x = w m, y =

More information

Context-Free Languages & Grammars (CFLs & CFGs) Reading: Chapter 5

Context-Free Languages & Grammars (CFLs & CFGs) Reading: Chapter 5 Context-Free Languages & Grammars (CFLs & CFGs) Reading: Chapter 5 1 Not all languages are regular So what happens to the languages which are not regular? Can we still come up with a language recognizer?

More information

Learn Smart and Grow with world

Learn Smart and Grow with world Learn Smart and Grow with world All Department Smart Study Materials Available Smartkalvi.com TABLE OF CONTENTS S.No DATE TOPIC PAGE NO. UNIT-I FINITE AUTOMATA 1 Introduction 1 2 Basic Mathematical Notation

More information

Introduction to Automata Theory

Introduction to Automata Theory Introduction to Automata Theory Automata theory is basically about the study of different mechanisms for generation and recognition of languages. Automata theory is basically for the study of different

More information

Question Bank. 10CS63:Compiler Design

Question Bank. 10CS63:Compiler Design Question Bank 10CS63:Compiler Design 1.Determine whether the following regular expressions define the same language? (ab)* and a*b* 2.List the properties of an operator grammar 3. Is macro processing a

More information

CS5371 Theory of Computation. Lecture 8: Automata Theory VI (PDA, PDA = CFG)

CS5371 Theory of Computation. Lecture 8: Automata Theory VI (PDA, PDA = CFG) CS5371 Theory of Computation Lecture 8: Automata Theory VI (PDA, PDA = CFG) Objectives Introduce Pushdown Automaton (PDA) Show that PDA = CFG In terms of descriptive power Pushdown Automaton (PDA) Roughly

More information

Finite Automata. Dr. Nadeem Akhtar. Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur

Finite Automata. Dr. Nadeem Akhtar. Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur Finite Automata Dr. Nadeem Akhtar Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur PhD Laboratory IRISA-UBS University of South Brittany European University

More information

Theory of Computation Dr. Weiss Extra Practice Exam Solutions

Theory of Computation Dr. Weiss Extra Practice Exam Solutions Name: of 7 Theory of Computation Dr. Weiss Extra Practice Exam Solutions Directions: Answer the questions as well as you can. Partial credit will be given, so show your work where appropriate. Try to be

More information

Theory of Computation

Theory of Computation Theory of Computation For Computer Science & Information Technology By www.thegateacademy.com Syllabus Syllabus for Theory of Computation Regular Expressions and Finite Automata, Context-Free Grammar s

More information

TOPIC PAGE NO. UNIT-I FINITE AUTOMATA

TOPIC PAGE NO. UNIT-I FINITE AUTOMATA TABLE OF CONTENTS SNo DATE TOPIC PAGE NO UNIT-I FINITE AUTOMATA 1 Introduction 1 2 Basic Mathematical Notation Techniques 3 3 Finite State systems 4 4 Basic Definitions 6 5 Finite Automaton 7 6 DFA NDFA

More information

CS/B.Tech/CSE/IT/EVEN/SEM-4/CS-402/ ItIauIafIaAblll~AladUnrtel1ity

CS/B.Tech/CSE/IT/EVEN/SEM-4/CS-402/ ItIauIafIaAblll~AladUnrtel1ity CS/B.Tech/CSE/IT/EVEN/SEM-4/CS-402/2015-16 ItIauIafIaAblll~AladUnrtel1ity ~ t; ~~ ) MAULANA ABUL KALAM AZAD UNIVERSITY OF TECHNOLOGY, WEST BENGAL Paper Code: CS-402 FORMAL LANGUAGE AND AUTOMATA THEORY

More information

Introduction to Syntax Analysis

Introduction to Syntax Analysis Compiler Design 1 Introduction to Syntax Analysis Compiler Design 2 Syntax Analysis The syntactic or the structural correctness of a program is checked during the syntax analysis phase of compilation.

More information

Complexity Theory. Compiled By : Hari Prasad Pokhrel Page 1 of 20. ioenotes.edu.np

Complexity Theory. Compiled By : Hari Prasad Pokhrel Page 1 of 20. ioenotes.edu.np Chapter 1: Introduction Introduction Purpose of the Theory of Computation: Develop formal mathematical models of computation that reflect real-world computers. Nowadays, the Theory of Computation can be

More information

CS402 - Theory of Automata Glossary By

CS402 - Theory of Automata Glossary By CS402 - Theory of Automata Glossary By Acyclic Graph : A directed graph is said to be acyclic if it contains no cycles. Algorithm : A detailed and unambiguous sequence of instructions that describes how

More information

Introduction to Syntax Analysis. The Second Phase of Front-End

Introduction to Syntax Analysis. The Second Phase of Front-End Compiler Design IIIT Kalyani, WB 1 Introduction to Syntax Analysis The Second Phase of Front-End Compiler Design IIIT Kalyani, WB 2 Syntax Analysis The syntactic or the structural correctness of a program

More information

Decision Properties for Context-free Languages

Decision Properties for Context-free Languages Previously: Decision Properties for Context-free Languages CMPU 240 Language Theory and Computation Fall 2018 Context-free languages Pumping Lemma for CFLs Closure properties for CFLs Today: Assignment

More information

CS402 - Theory of Automata FAQs By

CS402 - Theory of Automata FAQs By CS402 - Theory of Automata FAQs By Define the main formula of Regular expressions? Define the back ground of regular expression? Regular expressions are a notation that you can think of similar to a programming

More information

DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY SIRUVACHUR, PERAMBALUR DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY SIRUVACHUR, PERAMBALUR DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY SIRUVACHUR, PERAMBALUR-621113 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Third Year CSE( Sem:V) CS2303- THEORY OF COMPUTATION PART B-16

More information

COMP-421 Compiler Design. Presented by Dr Ioanna Dionysiou

COMP-421 Compiler Design. Presented by Dr Ioanna Dionysiou COMP-421 Compiler Design Presented by Dr Ioanna Dionysiou Administrative! [ALSU03] Chapter 3 - Lexical Analysis Sections 3.1-3.4, 3.6-3.7! Reading for next time [ALSU03] Chapter 3 Copyright (c) 2010 Ioanna

More information

Regular Languages and Regular Expressions

Regular Languages and Regular Expressions Regular Languages and Regular Expressions According to our definition, a language is regular if there exists a finite state automaton that accepts it. Therefore every regular language can be described

More information

Closure Properties of CFLs; Introducing TMs. CS154 Chris Pollett Apr 9, 2007.

Closure Properties of CFLs; Introducing TMs. CS154 Chris Pollett Apr 9, 2007. Closure Properties of CFLs; Introducing TMs CS154 Chris Pollett Apr 9, 2007. Outline Closure Properties of Context Free Languages Algorithms for CFLs Introducing Turing Machines Closure Properties of CFL

More information

Last lecture CMSC330. This lecture. Finite Automata: States. Finite Automata. Implementing Regular Expressions. Languages. Regular expressions

Last lecture CMSC330. This lecture. Finite Automata: States. Finite Automata. Implementing Regular Expressions. Languages. Regular expressions Last lecture CMSC330 Finite Automata Languages Sets of strings Operations on languages Regular expressions Constants Operators Precedence 1 2 Finite automata States Transitions Examples Types This lecture

More information

MIT Specifying Languages with Regular Expressions and Context-Free Grammars

MIT Specifying Languages with Regular Expressions and Context-Free Grammars MIT 6.035 Specifying Languages with Regular essions and Context-Free Grammars Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology Language Definition Problem How to precisely

More information

Where We Are. CMSC 330: Organization of Programming Languages. This Lecture. Programming Languages. Motivation for Grammars

Where We Are. CMSC 330: Organization of Programming Languages. This Lecture. Programming Languages. Motivation for Grammars CMSC 330: Organization of Programming Languages Context Free Grammars Where We Are Programming languages Ruby OCaml Implementing programming languages Scanner Uses regular expressions Finite automata Parser

More information

MIT Specifying Languages with Regular Expressions and Context-Free Grammars. Martin Rinard Massachusetts Institute of Technology

MIT Specifying Languages with Regular Expressions and Context-Free Grammars. Martin Rinard Massachusetts Institute of Technology MIT 6.035 Specifying Languages with Regular essions and Context-Free Grammars Martin Rinard Massachusetts Institute of Technology Language Definition Problem How to precisely define language Layered structure

More information

Formal Languages and Automata

Formal Languages and Automata Mobile Computing and Software Engineering p. 1/3 Formal Languages and Automata Chapter 3 Regular languages and Regular Grammars Chuan-Ming Liu cmliu@csie.ntut.edu.tw Department of Computer Science and

More information

ECS 120 Lesson 7 Regular Expressions, Pt. 1

ECS 120 Lesson 7 Regular Expressions, Pt. 1 ECS 120 Lesson 7 Regular Expressions, Pt. 1 Oliver Kreylos Friday, April 13th, 2001 1 Outline Thus far, we have been discussing one way to specify a (regular) language: Giving a machine that reads a word

More information

1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which:

1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which: P R O B L E M S Finite Autom ata. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which: a) Are a multiple of three in length. b) End with the string

More information

Models of Computation II: Grammars and Pushdown Automata

Models of Computation II: Grammars and Pushdown Automata Models of Computation II: Grammars and Pushdown Automata COMP1600 / COMP6260 Dirk Pattinson Australian National University Semester 2, 2018 Catch Up / Drop in Lab Session 1 Monday 1100-1200 at Room 2.41

More information

LECTURE NOTES THEORY OF COMPUTATION

LECTURE NOTES THEORY OF COMPUTATION LECTURE NOTES ON THEORY OF COMPUTATION P Anjaiah Assistant Professor Ms. B Ramyasree Assistant Professor Ms. E Umashankari Assistant Professor Ms. A Jayanthi Assistant Professor INSTITUTE OF AERONAUTICAL

More information

Theory of Computation, Homework 3 Sample Solution

Theory of Computation, Homework 3 Sample Solution Theory of Computation, Homework 3 Sample Solution 3.8 b.) The following machine M will do: M = "On input string : 1. Scan the tape and mark the first 1 which has not been marked. If no unmarked 1 is found,

More information

REGULAR EXPRESSIONS AND LANGUAGES

REGULAR EXPRESSIONS AND LANGUAGES CS2303 THEORY OF COMPUTATION AIM To have a introductory knowledge of automata, formal language theory and computability. OBJECTIVES UNIT I To have an understanding of finite state and pushdown automata.

More information

I have read and understand all of the instructions below, and I will obey the Academic Honor Code.

I have read and understand all of the instructions below, and I will obey the Academic Honor Code. Midterm Exam CS 341-451: Foundations of Computer Science II Fall 2014, elearning section Prof. Marvin K. Nakayama Print family (or last) name: Print given (or first) name: I have read and understand all

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Lecture 11 Ana Bove April 26th 2018 Recap: Regular Languages Decision properties of RL: Is it empty? Does it contain this word? Contains

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Context Free Grammars 1 Architecture of Compilers, Interpreters Source Analyzer Optimizer Code Generator Abstract Syntax Tree Front End Back End Compiler

More information

Limits of Computation p.1/?? Limits of Computation p.2/??

Limits of Computation p.1/?? Limits of Computation p.2/?? Context-Free Grammars (CFG) There are languages, such as {0 n 1 n n 0} that cannot be described (specified) by finite automata or regular expressions. Context-free grammars provide a more powerful mechanism

More information

KHALID PERVEZ (MBA+MCS) CHICHAWATNI

KHALID PERVEZ (MBA+MCS) CHICHAWATNI FAQ's about Lectures 1 to 5 QNo1.What is the difference between the strings and the words of a language? A string is any combination of the letters of an alphabet where as the words of a language are the

More information

University of Nevada, Las Vegas Computer Science 456/656 Fall 2016

University of Nevada, Las Vegas Computer Science 456/656 Fall 2016 University of Nevada, Las Vegas Computer Science 456/656 Fall 2016 The entire examination is 925 points. The real final will be much shorter. Name: No books, notes, scratch paper, or calculators. Use pen

More information

DVA337 HT17 - LECTURE 4. Languages and regular expressions

DVA337 HT17 - LECTURE 4. Languages and regular expressions DVA337 HT17 - LECTURE 4 Languages and regular expressions 1 SO FAR 2 TODAY Formal definition of languages in terms of strings Operations on strings and languages Definition of regular expressions Meaning

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016 Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016 Lecture 15 Ana Bove May 23rd 2016 More on Turing machines; Summary of the course. Overview of today s lecture: Recap: PDA, TM Push-down

More information

Formal Languages and Compilers Lecture IV: Regular Languages and Finite. Finite Automata

Formal Languages and Compilers Lecture IV: Regular Languages and Finite. Finite Automata Formal Languages and Compilers Lecture IV: Regular Languages and Finite Automata Free University of Bozen-Bolzano Faculty of Computer Science POS Building, Room: 2.03 artale@inf.unibz.it http://www.inf.unibz.it/

More information

CMSC 330: Organization of Programming Languages. Architecture of Compilers, Interpreters

CMSC 330: Organization of Programming Languages. Architecture of Compilers, Interpreters : Organization of Programming Languages Context Free Grammars 1 Architecture of Compilers, Interpreters Source Scanner Parser Static Analyzer Intermediate Representation Front End Back End Compiler / Interpreter

More information

LECTURE NOTES THEORY OF COMPUTATION

LECTURE NOTES THEORY OF COMPUTATION LECTURE NOTES ON THEORY OF COMPUTATION Dr. K Rajendra Prasad Professor Ms. N Mamtha Assistant Professor Ms. S Swarajya Lakshmi Assistant Professor Mr. D Abdulla Assistant Professor INSTITUTE OF AERONAUTICAL

More information

Automata Theory CS S-FR Final Review

Automata Theory CS S-FR Final Review Automata Theory CS411-2015S-FR Final Review David Galles Department of Computer Science University of San Francisco FR-0: Sets & Functions Sets Membership: a?{a,b,c} a?{b,c} a?{b,{a,b,c},d} {a,b,c}?{b,{a,b,c},d}

More information

Chapter 14: Pushdown Automata

Chapter 14: Pushdown Automata Chapter 14: Pushdown Automata Peter Cappello Department of Computer Science University of California, Santa Barbara Santa Barbara, CA 93106 cappello@cs.ucsb.edu The corresponding textbook chapter should

More information

Theory and Compiling COMP360

Theory and Compiling COMP360 Theory and Compiling COMP360 It has been said that man is a rational animal. All my life I have been searching for evidence which could support this. Bertrand Russell Reading Read sections 2.1 3.2 in the

More information

1. [5 points each] True or False. If the question is currently open, write O or Open.

1. [5 points each] True or False. If the question is currently open, write O or Open. University of Nevada, Las Vegas Computer Science 456/656 Spring 2018 Practice for the Final on May 9, 2018 The entire examination is 775 points. The real final will be much shorter. Name: No books, notes,

More information

COP 3402 Systems Software Syntax Analysis (Parser)

COP 3402 Systems Software Syntax Analysis (Parser) COP 3402 Systems Software Syntax Analysis (Parser) Syntax Analysis 1 Outline 1. Definition of Parsing 2. Context Free Grammars 3. Ambiguous/Unambiguous Grammars Syntax Analysis 2 Lexical and Syntax Analysis

More information

Decision, Computation and Language

Decision, Computation and Language Decision, Computation and Language Regular Expressions Dr. Muhammad S Khan (mskhan@liv.ac.uk) Ashton Building, Room G22 http://www.csc.liv.ac.uk/~khan/comp218 Regular expressions M S Khan (Univ. of Liverpool)

More information

Formal Languages and Compilers Lecture VI: Lexical Analysis

Formal Languages and Compilers Lecture VI: Lexical Analysis Formal Languages and Compilers Lecture VI: Lexical Analysis Free University of Bozen-Bolzano Faculty of Computer Science POS Building, Room: 2.03 artale@inf.unibz.it http://www.inf.unibz.it/ artale/ Formal

More information

UNION-FREE DECOMPOSITION OF REGULAR LANGUAGES

UNION-FREE DECOMPOSITION OF REGULAR LANGUAGES UNION-FREE DECOMPOSITION OF REGULAR LANGUAGES Thesis submitted in partial fulfillment of the requirements for the award of degree of Master of Engineering in Computer Science and Engineering Submitted

More information

Part 5 Program Analysis Principles and Techniques

Part 5 Program Analysis Principles and Techniques 1 Part 5 Program Analysis Principles and Techniques Front end 2 source code scanner tokens parser il errors Responsibilities: Recognize legal programs Report errors Produce il Preliminary storage map Shape

More information

ROEVER COLLEGE OF ENGINEERING AND TECHNOLOGY Elambalur, Perambalur DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT-I AUTOMATA

ROEVER COLLEGE OF ENGINEERING AND TECHNOLOGY Elambalur, Perambalur DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT-I AUTOMATA ROEVER COLLEGE OF ENGINEERING AND TECHNOLOGY Elambalur, Perambalur 621 220 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Year & Semester : III / V Subject Code : CS6503 Subject Name : Theory of Computation

More information

Context Free Languages and Pushdown Automata

Context Free Languages and Pushdown Automata Context Free Languages and Pushdown Automata COMP2600 Formal Methods for Software Engineering Ranald Clouston Australian National University Semester 2, 2013 COMP 2600 Context Free Languages and Pushdown

More information

UNIT -2 LEXICAL ANALYSIS

UNIT -2 LEXICAL ANALYSIS OVER VIEW OF LEXICAL ANALYSIS UNIT -2 LEXICAL ANALYSIS o To identify the tokens we need some method of describing the possible tokens that can appear in the input stream. For this purpose we introduce

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2017 http://cseweb.ucsd.edu/classes/sp17/cse105-ab/ Today's learning goals Sipser Ch 1.2, 1.3 Design NFA recognizing a given language Convert an NFA (with or without

More information

Gujarat Technological University Sankalchand Patel College of Engineering, Visnagar B.E. Semester VII (CE) July-Nov Compiler Design (170701)

Gujarat Technological University Sankalchand Patel College of Engineering, Visnagar B.E. Semester VII (CE) July-Nov Compiler Design (170701) Gujarat Technological University Sankalchand Patel College of Engineering, Visnagar B.E. Semester VII (CE) July-Nov 2014 Compiler Design (170701) Question Bank / Assignment Unit 1: INTRODUCTION TO COMPILING

More information

Regular Languages. MACM 300 Formal Languages and Automata. Formal Languages: Recap. Regular Languages

Regular Languages. MACM 300 Formal Languages and Automata. Formal Languages: Recap. Regular Languages Regular Languages MACM 3 Formal Languages and Automata Anoop Sarkar http://www.cs.sfu.ca/~anoop The set of regular languages: each element is a regular language Each regular language is an example of a

More information

Chapter Seven: Regular Expressions

Chapter Seven: Regular Expressions Chapter Seven: Regular Expressions Regular Expressions We have seen that DFAs and NFAs have equal definitional power. It turns out that regular expressions also have exactly that same definitional power:

More information

Architecture of Compilers, Interpreters. CMSC 330: Organization of Programming Languages. Front End Scanner and Parser. Implementing the Front End

Architecture of Compilers, Interpreters. CMSC 330: Organization of Programming Languages. Front End Scanner and Parser. Implementing the Front End Architecture of Compilers, Interpreters : Organization of Programming Languages ource Analyzer Optimizer Code Generator Context Free Grammars Intermediate Representation Front End Back End Compiler / Interpreter

More information

Name: Finite Automata

Name: Finite Automata Unit No: I Name: Finite Automata What is TOC? In theoretical computer science, the theory of computation is the branch that deals with whether and how efficiently problems can be solved on a model of computation,

More information

CS 403 Compiler Construction Lecture 3 Lexical Analysis [Based on Chapter 1, 2, 3 of Aho2]

CS 403 Compiler Construction Lecture 3 Lexical Analysis [Based on Chapter 1, 2, 3 of Aho2] CS 403 Compiler Construction Lecture 3 Lexical Analysis [Based on Chapter 1, 2, 3 of Aho2] 1 What is Lexical Analysis? First step of a compiler. Reads/scans/identify the characters in the program and groups

More information

Zhizheng Zhang. Southeast University

Zhizheng Zhang. Southeast University Zhizheng Zhang Southeast University 2016/10/5 Lexical Analysis 1 1. The Role of Lexical Analyzer 2016/10/5 Lexical Analysis 2 2016/10/5 Lexical Analysis 3 Example. position = initial + rate * 60 2016/10/5

More information

Nondeterministic Finite Automata (NFA): Nondeterministic Finite Automata (NFA) states of an automaton of this kind may or may not have a transition for each symbol in the alphabet, or can even have multiple

More information

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design i About the Tutorial A compiler translates the codes written in one language to some other language without changing the meaning of the program. It is also expected that a compiler should make the target

More information

Definition 2.8: A CFG is in Chomsky normal form if every rule. only appear on the left-hand side, we allow the rule S ǫ.

Definition 2.8: A CFG is in Chomsky normal form if every rule. only appear on the left-hand side, we allow the rule S ǫ. CS533 Class 02b: 1 c P. Heeman, 2017 CNF Pushdown Automata Definition Equivalence Overview CS533 Class 02b: 2 c P. Heeman, 2017 Chomsky Normal Form Definition 2.8: A CFG is in Chomsky normal form if every

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Context Free Grammars 1 Architecture of Compilers, Interpreters Source Analyzer Optimizer Code Generator Abstract Syntax Tree Front End Back End Compiler

More information

Lexical Analysis. Prof. James L. Frankel Harvard University

Lexical Analysis. Prof. James L. Frankel Harvard University Lexical Analysis Prof. James L. Frankel Harvard University Version of 5:37 PM 30-Jan-2018 Copyright 2018, 2016, 2015 James L. Frankel. All rights reserved. Regular Expression Notation We will develop a

More information

Turing Machines. A transducer is a finite state machine (FST) whose output is a string and not just accept or reject.

Turing Machines. A transducer is a finite state machine (FST) whose output is a string and not just accept or reject. Turing Machines Transducers: A transducer is a finite state machine (FST) whose output is a string and not just accept or reject. Each transition of an FST is labeled with two symbols, one designating

More information

Chapter 3: CONTEXT-FREE GRAMMARS AND PARSING Part 1

Chapter 3: CONTEXT-FREE GRAMMARS AND PARSING Part 1 Chapter 3: CONTEXT-FREE GRAMMARS AND PARSING Part 1 1. Introduction Parsing is the task of Syntax Analysis Determining the syntax, or structure, of a program. The syntax is defined by the grammar rules

More information

PS3 - Comments. Describe precisely the language accepted by this nondeterministic PDA.

PS3 - Comments. Describe precisely the language accepted by this nondeterministic PDA. University of Virginia - cs3102: Theory of Computation Spring 2010 PS3 - Comments Average: 46.6 (full credit for each question is 55 points) Problem 1: Mystery Language. (Average 8.5 / 10) In Class 7,

More information

Theory Bridge Exam Example Questions Version of June 6, 2008

Theory Bridge Exam Example Questions Version of June 6, 2008 Theory Bridge Exam Example Questions Version of June 6, 2008 This is a collection of sample theory bridge exam questions. This is just to get some idea of the format of the bridge exam and the level of

More information

Lexical Analysis. Dragon Book Chapter 3 Formal Languages Regular Expressions Finite Automata Theory Lexical Analysis using Automata

Lexical Analysis. Dragon Book Chapter 3 Formal Languages Regular Expressions Finite Automata Theory Lexical Analysis using Automata Lexical Analysis Dragon Book Chapter 3 Formal Languages Regular Expressions Finite Automata Theory Lexical Analysis using Automata Phase Ordering of Front-Ends Lexical analysis (lexer) Break input string

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Context Free Grammars and Parsing 1 Recall: Architecture of Compilers, Interpreters Source Parser Static Analyzer Intermediate Representation Front End Back

More information

Parsing. source code. while (k<=n) {sum = sum+k; k=k+1;}

Parsing. source code. while (k<=n) {sum = sum+k; k=k+1;} Compiler Construction Grammars Parsing source code scanner tokens regular expressions lexical analysis Lennart Andersson parser context free grammar Revision 2012 01 23 2012 parse tree AST builder (implicit)

More information

CMSC 330: Organization of Programming Languages. Context Free Grammars

CMSC 330: Organization of Programming Languages. Context Free Grammars CMSC 330: Organization of Programming Languages Context Free Grammars 1 Architecture of Compilers, Interpreters Source Analyzer Optimizer Code Generator Abstract Syntax Tree Front End Back End Compiler

More information

1. (10 points) Draw the state diagram of the DFA that recognizes the language over Σ = {0, 1}

1. (10 points) Draw the state diagram of the DFA that recognizes the language over Σ = {0, 1} CSE 5 Homework 2 Due: Monday October 6, 27 Instructions Upload a single file to Gradescope for each group. should be on each page of the submission. All group members names and PIDs Your assignments in

More information

CS 44 Exam #2 February 14, 2001

CS 44 Exam #2 February 14, 2001 CS 44 Exam #2 February 14, 2001 Name Time Started: Time Finished: Each question is equally weighted. You may omit two questions, but you must answer #8, and you can only omit one of #6 or #7. Circle the

More information