×
Nothing in the world is more common than unsuccessful people with talent.
--Your friends at LectureNotes
Close

Note for Theory Of Computation - TC By Umesh Kumar

  • Theory Of Computation - TC
  • Note
  • 5 Topics
  • 2020 Views
  • 51 Offline Downloads
  • Uploaded 4 months ago
Umesh Kumar
Umesh Kumar
0 User(s)
Download PDFOrder Printed Copy

Share it with your friends

Leave your Comments

Text from page-1

ATAL BIHARI VAJPAYEE VISHWAVIDYALAYA, BILASPUR LECTURE NOTES ON THEORY OF COMPUTATION AND COMPILER DESIGN MSC (CS) II YEAR III SEMETER (PAPER-I) Mr. UMESH KUMAR, MCA (GGU) DEPARTMENT OF COMPUTER SCIENCE AND INFORMATION TECHNOLOGY BILASPUR VISHWAVIDYALAY, BILASPUR NEAR GANDHI CHOWK, CHHATTISAGARH 495009 By Mr. UMESH KUMAR, MCA (GGU) Page | 1 Department of computer science and information technology

Text from page-2

PAPER-I THEORY OF COMPUTATION AND COMPILER DESIGN UNIT-I Automata, Regular Expressions and Languages Principles of mathematical induction ,Finite Automata(FA), Deterministic Finite Automata(DFA), Non-deterministic Finite Automata(NFA). Regular Expression, FA and Regular Expressions, Proving languages not to be regular, Closure properties of regular languages, Equivalence and minimization of Automata. UNIT-II Context-Free Grammars and Languages Context-Free Grammar (CFG), Parse Trees, Ambiguity in grammars and languages Definition of the Pushdown automata, Languages of a Pushdown Automata, Equivalence of Pushdown automata and CFG, Deterministic Pushdown Automata. UNIT-III Properties of Context-Free Languages, Undecidabality Normal forms for CFG, Pumping Lemma for CFL, Closure Properties of CFL, Turing Machines, A language that is not Recursively Enumerable (RE), An undecidable problem that is RE, Undecidable problems about Turing Machine, Post‟s Correspondence Problem. UNIT- IV Introduction to Compiling & Syntax Analysis Compilers − Analysis of the source program, Phases of a compiler, Compiler construction tools Lexical analysis , Role of lexical analyzer ,Role of the parser, Writing grammars, Context-free grammars ,Top down parsing, Bottom-up parsing, Shift reduce parsing, Operator precedence parsing, LR parsers , SLR parser. UNIT-V Code Generation & Optimization, Run Time Environments Issues in the design of code generation, Basic blocks and flow graphs ,A simple code generator − DAG representation of basic blocks , Peephole optimization. Principal sources of optimization, Optimization of basic blocks, Introduction to global data flow analysis, Runtime environments. By Mr. UMESH KUMAR, MCA (GGU) Page | 2 Department of computer science and information technology

Text from page-3

UNIT-I Theory of Automata      Theory of automata is a theoretical branch of computer science and mathematical. It is the study of abstract machines and the computation problems that can be solved using these machines. The abstract machine is called the automata. The main motivation behind developing the automata theory was to develop methods to describe and analyze the dynamic behavior of discrete systems. This automaton consists of states and transitions. The State is represented by circles, and the Transitions is represented by arrows. Automata is the kind of machine which takes some string as input and this input goes through a finite number of states and may enter in the final state. Automata  The word "Automata" is depicted from the Greek word "αὐτόματα" which coveys "self-acting".  An automaton (Automata in plural) is known as an abstract self-propelled computing device to be determined to operate sequence of operations automatically.  A Finite Automaton (FA) or Finite State Machine (FSM) is known as an automaton with a finite number of states. Formal definition of a Finite Automaton An automaton is determined by a 5-tuple (Q, ∑, δ,q0, F), where − 1. Q is a finite set of states. 2. ∑ is a finite set of symbols, called the alphabet of the automaton. 3. δ is the transition function. 4. q0 is the initial state from where any input is processed (q0∈ Q). 5. F is a set of final state/states of Q (F ⊆ Q). Related Terminologies 1. Alphabet Definition − An alphabet is any finite set of symbols. Example − ∑ = {a, b, c, d} is an alphabet set where „a‟, „b‟, „c‟, and „d‟ are symbols. 2. String Definition − A string is a finite sequence of symbols taken from ∑. Example − „cabcad‟ is a valid string on the alphabet set ∑ = {a, b, c, d} 3. Length of a String Definition − It is the number of symbols present in a string. (Denoted by |S|). Examples − If S = „cabcad‟, |S|= 6 If |S|= 0, it is called an empty string (Denoted by λ or ε) 4. Kleene Star Definition − The Kleene star, ∑*, is called as a unary operator on a set of symbols or strings, ∑, that gives the infinite set of all possible strings of all possible lengths over ∑including λ. By Mr. UMESH KUMAR, MCA (GGU) Page | 3 Department of computer science and information technology

Text from page-4

Representation −∑* = ∑0∪ ∑1∪ ∑2∪…….where ∑p is the set of all possible strings of length p. Example − If ∑ = {a, b}, ∑* = {λ, a, b, aa, ab, ba, bb,………..} 5. Kleene Closure / Plus Definition − The set ∑+ is the infinite set of all possible strings of all possible lengths over ∑ excluding λ. Representation − ∑+= ∑1∪ ∑2∪ ∑3∪……. ∑+= ∑* − { λ } Example − If ∑ = { a, b } , ∑+ = { a, b, aa, ab, ba, bb,………..} 6. Language Definition − A language is a subset of ∑* for some alphabet ∑. It can be finite or infinite. Example − If the language takes all possible strings of length 2 over ∑ = {a, b}, then L = { ab, bb, ba, bb} Regular Expressions  The language accepted by finite automata can be easily described by simple expressions called Regular Expressions. It is the most effective way to represent any language.  The languages accepted by some regular expression are referred to as Regular languages.  A regular expression can also be described as a sequence of pattern that defines a string.  Regular expressions are used to match character combinations in strings. String searching algorithm used this pattern to find the operations on a string. For instance: In a regular expression, x* means zero or more occurrence of x. It can generate {e, x, xx, xxx, xxxx, .....} In a regular expression, x+ means one or more occurrence of x. It can generate {x, xx, xxx, xxxx, .....} Operations on Regular Language The various operations on regular language are: Union: If L and M are two regular languages then their union L U M is also a union. 1. L U M = {s | s is in L or s is in M} Intersection: If L and M are two regular languages then their intersection is also an intersection. 1. L ⋂ M = {st | s is in L and t is in M} Kleen closure: If L is a regular language then its Kleen closure L1* will also be a regular language. 1. L* = Zero or more occurrence of language L. Example 1: Write the regular expression for the language accepting all combinations of a's, over the set ∑ = {a} Solution: By Mr. UMESH KUMAR, MCA (GGU) Page | 4 Department of computer science and information technology

Lecture Notes