Context Sensitive Grammar

Total Page:16

File Type:pdf, Size:1020Kb

Context Sensitive Grammar Context Sensitive Grammar Aparna S Vijayan Department of Computer Science and Automation December 2, 2011 Aparna S Vijayan (CSA) CSG December 2, 2011 1 / 12 1 Definition of CSG 2 Context Sensitive Language(CSL) 3 Example of CSL 4 Chomsky Hierachy Contents Aparna S Vijayan (CSA) CSG December 2, 2011 2 / 12 2 Context Sensitive Language(CSL) 3 Example of CSL 4 Chomsky Hierachy Contents 1 Definition of CSG Aparna S Vijayan (CSA) CSG December 2, 2011 2 / 12 3 Example of CSL 4 Chomsky Hierachy Contents 1 Definition of CSG 2 Context Sensitive Language(CSL) Aparna S Vijayan (CSA) CSG December 2, 2011 2 / 12 4 Chomsky Hierachy Contents 1 Definition of CSG 2 Context Sensitive Language(CSL) 3 Example of CSL Aparna S Vijayan (CSA) CSG December 2, 2011 2 / 12 Contents 1 Definition of CSG 2 Context Sensitive Language(CSL) 3 Example of CSL 4 Chomsky Hierachy Aparna S Vijayan (CSA) CSG December 2, 2011 2 / 12 Definition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an unrestricted grammar in which every production has the form α ! β with jβj ≥ jαj (where α and β are strings of nonterminals and terminals). The concept of context-sensitive grammar was introduced by Noam Chomsky in the 1950. In every derivation the length of the string never decreases. The term "context-sensitive" comes from a normal form for these grammars,where each production is of the form α1Aα2!α1βα2,with β 6= . They permit replacement of variable A by string β only in the "context " α1 - α2. Aparna S Vijayan (CSA) CSG December 2, 2011 3 / 12 N=Set of non terminal symbols. Σ=Set of terminal symbols. S=Start symbol of the production. P=Finite set of productions. All rules in P are of the form α1Aα2!α1βα2. A 2 N ( A is a single nonterminal) + α1; α2; β 2 (N [ Σ) . Formal Definition A Context Sensitive Grammar is a 4-tuple , G = (N,Σ, P, S) where: Aparna S Vijayan (CSA) CSG December 2, 2011 4 / 12 Σ=Set of terminal symbols. S=Start symbol of the production. P=Finite set of productions. All rules in P are of the form α1Aα2!α1βα2. A 2 N ( A is a single nonterminal) + α1; α2; β 2 (N [ Σ) . Formal Definition A Context Sensitive Grammar is a 4-tuple , G = (N,Σ, P, S) where: N=Set of non terminal symbols. Aparna S Vijayan (CSA) CSG December 2, 2011 4 / 12 S=Start symbol of the production. P=Finite set of productions. All rules in P are of the form α1Aα2!α1βα2. A 2 N ( A is a single nonterminal) + α1; α2; β 2 (N [ Σ) . Formal Definition A Context Sensitive Grammar is a 4-tuple , G = (N,Σ, P, S) where: N=Set of non terminal symbols. Σ=Set of terminal symbols. Aparna S Vijayan (CSA) CSG December 2, 2011 4 / 12 P=Finite set of productions. All rules in P are of the form α1Aα2!α1βα2. A 2 N ( A is a single nonterminal) + α1; α2; β 2 (N [ Σ) . Formal Definition A Context Sensitive Grammar is a 4-tuple , G = (N,Σ, P, S) where: N=Set of non terminal symbols. Σ=Set of terminal symbols. S=Start symbol of the production. Aparna S Vijayan (CSA) CSG December 2, 2011 4 / 12 All rules in P are of the form α1Aα2!α1βα2. A 2 N ( A is a single nonterminal) + α1; α2; β 2 (N [ Σ) . Formal Definition A Context Sensitive Grammar is a 4-tuple , G = (N,Σ, P, S) where: N=Set of non terminal symbols. Σ=Set of terminal symbols. S=Start symbol of the production. P=Finite set of productions. Aparna S Vijayan (CSA) CSG December 2, 2011 4 / 12 Formal Definition A Context Sensitive Grammar is a 4-tuple , G = (N,Σ, P, S) where: N=Set of non terminal symbols. Σ=Set of terminal symbols. S=Start symbol of the production. P=Finite set of productions. All rules in P are of the form α1Aα2!α1βα2. A 2 N ( A is a single nonterminal) + α1; α2; β 2 (N [ Σ) . Aparna S Vijayan (CSA) CSG December 2, 2011 4 / 12 If G is a Context Sensitive Grammar then ∗ + L(G)= w (w 2 Σ ) ^ S )G w . Eg 1 of a context sensitive grammar G = ffS; A; B; C; a; b; cg ; fa; b; cg ; P; Sgwhere P is the set of rules. S! aSBC S ! aBC CB ! BC aB ! ab bB ! bb bC ! bc cC !cc The language generated by this grammar is fanbncnjn ≥ 1g : Context Sensitive Language The language generated by the Context Sensitive Grammar is called context sensitive language. Aparna S Vijayan (CSA) CSG December 2, 2011 5 / 12 Eg 1 of a context sensitive grammar G = ffS; A; B; C; a; b; cg ; fa; b; cg ; P; Sgwhere P is the set of rules. S! aSBC S ! aBC CB ! BC aB ! ab bB ! bb bC ! bc cC !cc The language generated by this grammar is fanbncnjn ≥ 1g : Context Sensitive Language The language generated by the Context Sensitive Grammar is called context sensitive language. If G is a Context Sensitive Grammar then ∗ + L(G)= w (w 2 Σ ) ^ S )G w . Aparna S Vijayan (CSA) CSG December 2, 2011 5 / 12 Context Sensitive Language The language generated by the Context Sensitive Grammar is called context sensitive language. If G is a Context Sensitive Grammar then ∗ + L(G)= w (w 2 Σ ) ^ S )G w . Eg 1 of a context sensitive grammar G = ffS; A; B; C; a; b; cg ; fa; b; cg ; P; Sgwhere P is the set of rules. S! aSBC S ! aBC CB ! BC aB ! ab bB ! bb bC ! bc cC !cc The language generated by this grammar is fanbncnjn ≥ 1g : Aparna S Vijayan (CSA) CSG December 2, 2011 5 / 12 S ) aSBC ) aaBCBC ) aabCBC ) aabBCC ) aabbCC ) aabbcC ) aabbcc Context Sensitive Language The derivation for the string aabbcc is Aparna S Vijayan (CSA) CSG December 2, 2011 6 / 12 ) aaBCBC ) aabCBC ) aabBCC ) aabbCC ) aabbcC ) aabbcc Context Sensitive Language The derivation for the string aabbcc is S ) aSBC Aparna S Vijayan (CSA) CSG December 2, 2011 6 / 12 ) aabCBC ) aabBCC ) aabbCC ) aabbcC ) aabbcc Context Sensitive Language The derivation for the string aabbcc is S ) aSBC ) aaBCBC Aparna S Vijayan (CSA) CSG December 2, 2011 6 / 12 ) aabBCC ) aabbCC ) aabbcC ) aabbcc Context Sensitive Language The derivation for the string aabbcc is S ) aSBC ) aaBCBC ) aabCBC Aparna S Vijayan (CSA) CSG December 2, 2011 6 / 12 ) aabbCC ) aabbcC ) aabbcc Context Sensitive Language The derivation for the string aabbcc is S ) aSBC ) aaBCBC ) aabCBC ) aabBCC Aparna S Vijayan (CSA) CSG December 2, 2011 6 / 12 ) aabbcC ) aabbcc Context Sensitive Language The derivation for the string aabbcc is S ) aSBC ) aaBCBC ) aabCBC ) aabBCC ) aabbCC Aparna S Vijayan (CSA) CSG December 2, 2011 6 / 12 ) aabbcc Context Sensitive Language The derivation for the string aabbcc is S ) aSBC ) aaBCBC ) aabCBC ) aabBCC ) aabbCC ) aabbcC Aparna S Vijayan (CSA) CSG December 2, 2011 6 / 12 Context Sensitive Language The derivation for the string aabbcc is S ) aSBC ) aaBCBC ) aabCBC ) aabBCC ) aabbCC ) aabbcC ) aabbcc Aparna S Vijayan (CSA) CSG December 2, 2011 6 / 12 Example2 CSG L = (#a = #b = #c) G2 =(fS; A; B; C; a; b; cg ; fa; b; cg ; P; S) S! ABC S !ABCS AB! BA AC ! CA BC ! CB BA ! AB CA !AC CB ! BC A ! a B !b C !c Aparna S Vijayan (CSA) CSG December 2, 2011 7 / 12 Hierarchy of Formal Languages Aparna S Vijayan (CSA) CSG December 2, 2011 8 / 12 Relation between Formal Languages The CFL's not containing are properly contained in the context sensitive languages Not all Context Sensitive Languages are Context Free. Every Context Sensitive Language is recusive. Aparna S Vijayan (CSA) CSG December 2, 2011 9 / 12 Chomsky Hierachy Described by Chomsky in 1956. Four classes of language Type 3,Type2,Type1,Type 0 from most restrictive to most general(Unestricted). Each level of hierarchy can be characterized by a class of grammar. Aparna S Vijayan (CSA) CSG December 2, 2011 10 / 12 Chomsky Hierarchy Type Language productions Device 3 Regular A ! aB, A ! a Finite Automaton 2 CFL A ! α Pushdown Automaton 1 CSL α ! β,jβj ≥ jαj Linear Bounded Automaton 0 RE α ! β Turing Machine A,B! Nonterminals α,β! string of terminals and nonterminals a! terminal symbol Aparna S Vijayan (CSA) CSG December 2, 2011 11 / 12 References Introduction to Automata Theory Languages and Computation by "JOHN E HOPCROFT","JEFFERY D.ULLMAN". Introduction to Languages and the Theory of Computation "JOHN MARTIN" http://en.wikipedia.org/wiki/Context-sensitive grammar http://adammikeal.org/courses/compute/Chomsky Aparna S Vijayan (CSA) CSG December 2, 2011 12 / 12 Linear Bounded Automata Indu John Department of Computer Science and Automation Indian Institute of Science, Bangalore December 1, 2011 Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 1 / 14 Definition Results about LBAs CSLs and LBAs Overview Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 2 / 14 Results about LBAs CSLs and LBAs Overview Definition Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 2 / 14 CSLs and LBAs Overview Definition Results about LBAs Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 2 / 14 Overview Definition Results about LBAs CSLs and LBAs Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 2 / 14 Definition A Turing machine that uses only the tape space occupied by the input is called a linear-bounded automaton (LBA). A linear bounded automaton is a nondeterministic Turing machine M = (Q; Σ; Γ; δ; s; t; r) such that: There are two special tape symbols < and >(the left end marker and right end marker).
Recommended publications
  • Nooj Computational Devices Max Silberztein
    NooJ Computational Devices Max Silberztein To cite this version: Max Silberztein. NooJ Computational Devices. Formalising Natural Languages With NooJ, Jun 2012, Paris, France. hal-02435921 HAL Id: hal-02435921 https://hal.archives-ouvertes.fr/hal-02435921 Submitted on 11 Jan 2020 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. NOOJ COMPUTATIONAL DEVICES MAX SILBERZTEIN Introduction NooJ’s linguistic development environment provides tools for linguists to construct linguistic resources that formalize 7 types of linguistic phenomena: typography, orthography, inflectional and derivational morphology, local and structural syntax, and semantics. NooJ also provides a set of parsers that can process any linguistic resource for these 7 types, and apply it to any corpus of texts in order to extract examples, annotate matching sequences, perform statistical analyses, etc.1 NooJ’s approach to Linguistics is peculiar in the world of Computational Linguistics: instead of constructing a large single grammar to describe a particular natural language (e.g. “a grammar of English”), NooJ users typically construct, edit, test and maintain a large number of local (small) grammars; for instance, there is a grammar that describes how to conjugate the verb to be, another grammar that describes how to state a date in English, another grammar that describes the heads of Noun Phrases, etc.
    [Show full text]
  • CDM Context-Sensitive Grammars
    CDM Context-Sensitive Grammars 1 Context-Sensitive Grammars Klaus Sutner Carnegie Mellon Universality Linear Bounded Automata 70-cont-sens 2017/12/15 23:17 LBA and Counting Where Are We? 3 Postfix Calculators 4 Hewlett-Packard figured out 40 years ago the reverse Polish notation is by far the best way to perform lengthy arithmetic calculations. Very easy to implement with a stack. Context-free languages based on grammars with productions A α are very → important since they describe many aspects of programming languages and The old warhorse dc also uses RPN. admit very efficient parsers. 10 20 30 + * n CFLs have a natural machine model (PDA) that is useful e.g. to evaluate 500 arithmetic expressions. 10 20 30 f Properties of CFLs are mostly undecidable, Emptiness and Finiteness being 30 notable exceptions. 20 10 ^ n 1073741824000000000000000000000000000000 Languages versus Machines 5 Languages versus Machines 6 Why the hedging about “aspects of programming languages”? To deal with problems like this one we need to strengthen our grammars. The Because some properties of programming language lie beyond the power of key is to remove the constraint of being “context-free.” CFLs. Here is a classical example: variables must be declared before they can be used. This leads to another important grammar based class of languages: context-sensitive languages. As it turns out, CSL are plenty strong enough to begin describe programming languages—but in the real world it does not matter, it is int x; better to think of programming language as being context-free, plus a few ... extra constraints. x = 17; ..
    [Show full text]
  • Implementation of Unrestricted Grammar in to the Recursively Enumerable Language Using Turing Machine
    The International Journal Of Engineering And Science (IJES) ||Volume||2 ||Issue|| 3 ||Pages|| 56-59 ||2013|| ISSN: 2319 – 1813 ISBN: 2319 – 1805 Implementation of Unrestricted Grammar in To the Recursively Enumerable Language Using Turing Machine 1,Jainendra Singh, 2, Dr. S.K. Saxena 1,Department of Computer Science, Maharaja Surajmal Institute 2,Department of Computer Engineering, Delhi Technological University -------------------------------------------------------Abstract------------------------------------------------------- This paper presents the implementation of the unrestricted grammar in to recursively enumerable language for JFLAP platform. Automata play a major role in compiler design and parsing. The class of formal languages that work for the most complex problems belongs to the set of Recursively Enumerable Language (REL).RELs are accepted by the type of automata as Turing Machine. Turing Machines are the most powerful computational machines and are the theoretical basis for modern computers. Turing Machine works for all classes of languages including regular language, CFL as well as Recursive Enumerable Languages. Unrestricted grammar are much more powerful than restricted forms like the regular and context free grammars. In facts, unrestricted grammars corresponds to the largest family of languages so we can hope to recognize by mechanical means; that is unrestricted grammars generates exactly the family of recursively enumerable languages. Turing Machine is used to implementation of unrestricted grammar & RELs for JFLAP
    [Show full text]
  • Theory of Computation
    Theory of Computation Todd Gaugler December 14, 2011 2 Contents 1 Mathematical Background 5 1.1 Overview . .5 1.2 Number System . .5 1.3 Functions . .6 1.4 Relations . .6 1.5 Recursive Definitions . .8 1.6 Mathematical Induction . .9 2 Languages and Context-Free Grammars 11 2.1 Languages . 11 2.2 Counting the Rational Numbers . 13 2.3 Grammars . 14 2.4 Regular Grammar . 15 3 Normal Forms and Finite Automata 17 3.1 Review of Grammars . 17 3.2 Normal Forms . 18 3.3 Machines . 20 3.3.1 An NFA λ ..................................... 22 4 Regular Languages 23 4.1 Computation . 24 4.2 The Extended Transition Function . 24 4.3 Algorithms . 26 4.3.1 Removing Non-Determinism . 26 4.3.2 State Minimization . 26 4.3.3 Expression Graph . 26 4.4 The Relationship between a Regular Grammar and the Finite Automaton . 26 4.4.1 Building an NFA corresponding to a Regular Grammar . 27 4.4.2 Closure . 27 4.5 Review for the First Exam . 28 4.6 The Pumping Lemma . 28 5 Pushdown Automata and Context-Free Languages 31 5.1 Pushdown Automata . 31 5.2 Variations on the PDA Theme . 34 5.3 Acceptance of Context-Free Languages . 36 3 CONTENTS CONTENTS 5.4 The Pumping Lemma for Context-Free Languages . 36 5.5 Closure Properties of Context- Free Languages . 37 6 Turing Machines 39 6.1 The Standard Turing Machine . 39 6.2 Turing Machines as Language Acceptors . 40 6.3 Alternative Acceptance Criteria . 41 6.4 Multitrack Machines . 42 6.5 Two-Way Tape Machines .
    [Show full text]
  • Integrating JFLAP Into the Classroom
    Changes to JFLAP to Increase Its Use in Courses Susan H. Rodger Duke University [email protected] ITiCSE 2011 Darmstadt, Germany June 29, 2011 NSF Grants CCLI-0442513 and TUES-1044191 Co-Authors Henry Qin Jonathan Su Overview of JFLAP • Java Formal Languages and Automata Package • Instructional tool to learn concepts of Formal Languages and Automata Theory • Topics: – Regular Languages – Context-Free Languages – Recursively Enumerable Languages – Lsystems • With JFLAP your creations come to life! JFLAP – Regular Languages • Create – DFA and NFA – Moore and Mealy – regular grammar – regular expression • Conversions – NFA to DFA to minimal DFA – NFA regular expression – NFA regular grammar JFLAP – Regular languages (more) • Simulate DFA and NFA – Step with Closure or Step by State – Fast Run – Multiple Run • Combine two DFA • Compare Equivalence • Brute Force Parser • Pumping Lemma JFLAP – Context-free Languages • Create – Nondeterministic PDA – Context-free grammar – Pumping Lemma • Transform – PDA CFG – CFG PDA (LL & SLR parser) – CFG CNF – CFG Parse table (LL and SLR) – CFG Brute Force Parser JFLAP – Recursively Enumerable Languages • Create – Turing Machine (1-Tape) – Turing Machine (multi-tape) – Building Blocks – Unrestricted grammar • Parsing – Unrestricted grammar with brute force parser JFLAP - L-Systems • This L-System renders as a tree that grows larger with each successive derivation step. JFLAP’s Use Around the World • JFLAP web page has over 300,000 hits since 1996 • Google Search – JFLAP appears on over 9830 web pages
    [Show full text]
  • Automata Theory and Formal Languages
    Alberto Pettorossi Automata Theory and Formal Languages Third Edition ARACNE Contents Preface 7 Chapter 1. Formal Grammars and Languages 9 1.1. Free Monoids 9 1.2. Formal Grammars 10 1.3. The Chomsky Hierarchy 13 1.4. Chomsky Normal Form and Greibach Normal Form 19 1.5. Epsilon Productions 20 1.6. Derivations in Context-Free Grammars 24 1.7. Substitutions and Homomorphisms 27 Chapter 2. Finite Automata and Regular Grammars 29 2.1. Deterministic and Nondeterministic Finite Automata 29 2.2. Nondeterministic Finite Automata and S-extended Type 3 Grammars 33 2.3. Finite Automata and Transition Graphs 35 2.4. Left Linear and Right Linear Regular Grammars 39 2.5. Finite Automata and Regular Expressions 44 2.6. Arden Rule 56 2.7. Equations Between Regular Expressions 57 2.8. Minimization of Finite Automata 59 2.9. Pumping Lemma for Regular Languages 72 2.10. A Parser for Regular Languages 74 2.10.1. A Java Program for Parsing Regular Languages 82 2.11. Generalizations of Finite Automata 90 2.11.1. Moore Machines 91 2.11.2. Mealy Machines 91 2.11.3. Generalized Sequential Machines 92 2.12. Closure Properties of Regular Languages 94 2.13. Decidability Properties of Regular Languages 96 Chapter 3. Pushdown Automata and Context-Free Grammars 99 3.1. Pushdown Automata and Context-Free Languages 99 3.2. From PDA’s to Context-Free Grammars and Back: Some Examples 111 3.3. Deterministic PDA’s and Deterministic Context-Free Languages 117 3.4. Deterministic PDA’s and Grammars in Greibach Normal Form 121 3.5.
    [Show full text]
  • Context-Sensitive Grammars and Linear- Bounded Automata
    I. J. Computer Network and Information Security, 2016, 1, 61-66 Published Online January 2016 in MECS (http://www.mecs-press.org/) DOI: 10.5815/ijcnis.2016.01.08 Context-Sensitive Grammars and Linear- Bounded Automata Prem Nath The Patent Office, CP-2, Sector-5, Salt Lake, Kolkata-700091, India Email: [email protected] Abstract—Linear-bounded automata (LBA) accept The head moves left or right on the tape utilizing finite context-sensitive languages (CSLs) and CSLs are number of states. A finite contiguous portion of the tape generated by context-sensitive grammars (CSGs). So, for whose length is a linear function of the length of the every CSG/CSL there is a LBA. A CSG is converted into initial input can be accessed by the read/write head. This normal form like Kuroda normal form (KNF) and then limitation makes LBA a more accurate model of corresponding LBA is designed. There is no algorithm or computers that actually exists than a Turing machine in theorem for designing a linear-bounded automaton (LBA) some respects. for a context-sensitive grammar without converting the LBA are designed to use limited storage (limited tape). grammar into some kind of normal form like Kuroda So, as a safety feature, we shall employ end markers normal form (KNF). I have proposed an algorithm for ($ on the left and on the right) on tape and the head this purpose which does not require any modification or never goes past these markers. This will ensure that the normalization of a CSG. storage bound is maintained and helps to keep LBA from leaving their tape.
    [Show full text]
  • Recursively Enumerable
    Chapter 11 A HIERARCHY OF FORMAL LANGUAGES AND AUTOMATA Learning Objectives At the conclusion of the chapter, the student will be able to: • Explain the difference between recursive and recursively enumerable languages • Describe the type of productions in an unrestricted grammar • Identify the types of languages generated by unrestricted grammars • Describe the type of productions in a context sensitive grammar • Give a sequence of derivations to generate a string using the productions in a context sensitive grammar • Identify the types of languages generated by context-sensitive grammars • Construct a context-sensitive grammar to generate a particular language • Describe the structure and components of the Chomsky hierarchy Recursive and Recursively Enumerable Languages • A language L is recursively enumerable if there exists a Turing machine that accepts it (as we have previously stated, rejected strings cause the machine to either not halt or halt in a nonfinal state) • A language L is recursive if there exists a Turing machine that accepts it and is guaranteed to halt on every valid input string • In other words, a language is recursive if and only if there exists a membership algorithm for it Languages That Are Not Recursively Enumerable • Theorem 11.1 states that, for any nonempty alphabet, there exist languages not recursively enumerable • One proof involves a technique called diagonalization, which can be used to show that, in a sense, there are fewer Turing Machines than there are languages • More explicitly, Theorem 11.3 describes
    [Show full text]
  • Unrestricted Grammars
    Automata Theory CS411-2004F-13 Unrestricted Grammars David Galles Department of Computer Science University of San Francisco 13-0: Language Hierarchy Regular Regular Expressions Finite Automata Languaes Context Free Context-Free Grammars Push-Down Automata Languages Recusively Enumerable Languages ?? Turing Machines 13-1: CFG Review G = (V, Σ,R,S) V = Set of symbols, both terminals & non-terminals Σ ⊂ V set of terminals (alphabet for the language being described) R ⊂ ((V − Σ) × V ∗) Set of rules S ∈ (V − Σ) Start symbol 13-2: Unrestricted Grammars G = (V, Σ,R,S) V = Set of symbols, both terminals & non-terminals Σ ⊂ V set of terminals (alphabet for the language being described) R ⊂ (V ∗(V − Σ)V ∗ × V ∗) Set of rules S ∈ (V − Σ) Start symbol 13-3: Unrestricted Grammars R ⊂ (V ∗(V − Σ)V ∗ × V ∗) Set of rules In an Unrestricted Grammar, the left-hand side of a rule contains a string of terminals and non-terminals (at least one of which must be a non-terminal) Rules are applied just like CFGs: Find a substring that matches the LHS of some rule Replace with the RHS of the rule 13-4: Unrestricted Grammars To generate a string with an Unrestricted Grammar: Start with the initial symbol While the string contains at least one non-terminal: Find a substring that matches the LHS of some rule Replace that substring with the RHS of the rule 13-5: Unrestricted Grammars Example: Grammar for L = {anbncn : n> 0} First, generate (ABC)∗ Next, non-deterministically rearrange string Finally, convert to terminals (A → a, B → b, etc.), ensuring that string
    [Show full text]
  • Formal Languages and Automata
    Formal Languages and Automata Stephan Schulz & Jan Hladik [email protected] [email protected] L ⌃⇤ ✓ with contributions from David Suendermann 1 Table of Contents Formal Grammars and Context-Free Introduction Languages Basics of formal languages Formal Grammars The Chomsky Hierarchy Regular Languages and Finite Automata Right-linear Grammars Regular Expressions Context-free Grammars Finite Automata Push-Down Automata Non-Determinism Properties of Context-free Regular expressions and Finite Languages Automata Turing Machines and Languages of Type Minimisation 1 and 0 Equivalence Turing Machines The Pumping Lemma Unrestricted Grammars Properties of regular languages Linear Bounded Automata Scanners and Flex Properties of Type-0-languages 2 Outline Introduction Basics of formal languages Regular Languages and Finite Automata Scanners and Flex Formal Grammars and Context-Free Languages Turing Machines and Languages of Type 1 and 0 3 Introduction I Stephan Schulz I Dipl.-Inform., U. Kaiserslautern, 1995 I Dr. rer. nat., TU Munchen,¨ 2000 I Visiting professor, U. Miami, 2002 I Visiting professor, U. West Indies, 2005 I Lecturer (Hildesheim, Offenburg, . ) since 2009 I Industry experience: Building Air Traffic Control systems I System engineer, 2005 I Project manager, 2007 I Product Manager, 2013 I Professor, DHBW Stuttgart, 2014 Research: Logic & Automated Reasoning 4 Introduction I Jan Hladik I Dipl.-Inform.: RWTH Aachen, 2001 I Dr. rer. nat.: TU Dresden, 2007 I Industry experience: SAP Research I Work in publicly funded research projects I Collaboration with SAP product groups I Supervision of Bachelor, Master, and PhD students I Professor: DHBW Stuttgart, 2014 Research: Semantic Web, Semantic Technologies, Automated Reasoning 5 Literature I Scripts I The most up-to-date version of this document as well as auxiliary material will be made available online at http://wwwlehre.dhbw-stuttgart.de/ ˜sschulz/fla2015.html and http://wwwlehre.dhbw-stuttgart.de/ ˜hladik/FLA I Books I John E.
    [Show full text]
  • Csci 311, Models of Computation Chapter 11 a Hierarchy of Formal Languages and Automata
    CSci 311, Models of Computation Chapter 11 A Hierarchy of Formal Languages and Automata H. Conrad Cunningham 29 December 2015 Contents Introduction . 1 11.1 Recursive and Recursively Enumerable Languages . 2 11.1.1 Aside: Countability . 2 11.1.2 Definition of Recursively Enumerable Language . 2 11.1.3 Definition of Recursive Language . 2 11.1.4 Enumeration Procedure for Recursive Languages . 3 11.1.5 Enumeration Procedure for Recursively Enumerable Lan- guages . 3 11.1.6 Languages That are Not Recursively Enumerable . 4 11.1.7 A Language That is Not Recursively Enumerable . 5 11.1.8 A Language That is Recursively Enumerable but Not Recursive . 6 11.2 Unrestricted Grammars . 6 11.3 Context-Sensitive Grammars and Languages . 6 11.3.1 Linz Example 11.2 . 7 11.3.2 Linear Bounded Automata (lba) . 8 11.3.3 Relation Between Recursive and Context-Sensitive Lan- guages . 8 11.4 The Chomsky Hierarchy . 9 1 Copyright (C) 2015, H. Conrad Cunningham Acknowledgements: MS student Eli Allen assisted in preparation of these notes. These lecture notes are for use with Chapter 11 of the textbook: Peter Linz. Introduction to Formal Languages and Automata, Fifth Edition, Jones and Bartlett Learning, 2012.The terminology and notation used in these notes are similar to those used in the Linz textbook.This document uses several figures from the Linz textbook. Advisory: The HTML version of this document requires use of a browser that supports the display of MathML. A good choice as of December 2015 seems to be a recent version of Firefox from Mozilla.
    [Show full text]
  • Chapter 11 a Hierarchy of Formal Languages and Automata
    ✐ ✐ “15529˙CH11˙Linz” — 2011/1/12 — 10:03 — page 277 — #1 ✐ ✐ © Jones & Bartlett Learning, LLC © Jones & Bartlett Learning, LLC NOT FOR SALE OR DISTRIBUTION NOT FOR SALE OR DISTRIBUTION © Jones & Bartlett Learning, LLC © Jones & Bartlett Learning, LLC NOT FOR SALEChapter OR DISTRIBUTION 11NOT FOR SALE OR DISTRIBUTION A Hierarchy of © Jones & Bartlett Learning, LLC © Jones & Bartlett Learning, LLC NOT FOR SALE OR DISTRIBUTIONFormal LanguagesNOT FOR SALE OR DISTRIBUTION and Automata © Jones & Bartlett Learning, LLC © Jones & Bartlett Learning, LLC NOT FOR SALE OR DISTRIBUTION NOT FOR SALE OR DISTRIBUTION © Jones & Bartlett Learning, LLC © Jones & Bartlett Learning, LLC NOT FOR SALE OR DISTRIBUTION NOT FOR SALE OR DISTRIBUTION © Jones & Bartlett Learning, LLC © Jones & Bartlett Learning, LLC NOT FOR SALE OR DISTRIBUTIONe now return our attention to ourNOT main FOR interest, SALE the studyOR DISTRIBUTION of formal languages. Our immediate goal will be to examine the languages W associated with Turing machines and some of their restrictions. Be- cause Turing machines can perform any kind of algorithmic com- putation, we expect to find that the family of languages associated with © Jones & Bartlett Learning, LLC them isquite broad.© It Jones includesnot & Bartlett only regular Learning, and context-free LLC lan- guages, but also the various examples we have encountered that lie outside NOT FOR SALE OR DISTRIBUTIONthese families. The nontrivialNOT FOR question SALE is whether OR DISTRIBUTION there are any languages that are not accepted by some Turing machine. We will answer this ques- tion first by showing that there are more languages than Turing machines, so that there must be some languages for which there are no Turing ma- © Joneschines.
    [Show full text]