Conflict Removal. Less Than, Equals ( <= ) Conflict
|
|
- Rodger Greer
- 5 years ago
- Views:
Transcription
1 Conflict Removal As you have observed in a recent example, not all context free grammars are simple precedence grammars. You have also seen that a context free grammar that is not a simple precedence grammar can be transformed to achieve a simple precedence grammar. The goal in this transformation is to change the grammar so that it is simple precedence while keeping the language unchanged. Hence, the new context free, simple precedence grammar is called similar to the original context free, non-simple precedence grammar. We say that symbol V i has a simple precedence conflict with symbol V j if more than one simple precedence relation holds between V i and V j. There are four different types of simple precedence conflicts:. V i <= V j 2. V i >= V j 3. V i <> V j 4. V i <=> V j We will consider each type of simple precedence conflict below. Our goal is to keep the same language while changing the grammar so as to remove the simple precedence conflict. Less Than, Equals ( <= ) Conflict In the less than, equals conflict, we have V i <= V j. Remember that an equals relation is defined as: V i E V j holds if a right hand side of a production of the form V i V j where V i,v j V and, V *. and that a less than relation is defined as: V i L V j holds if a right hand side of a production of the form V i V k and V k + V j where V k V n, V i, V j V, and,, V *. Thus, if we have A = B and A < B, what we have is a right hand side of some production of the form α A B β, and another production whose right hand side is γ A C δ where C + B μ. The general strategy for a less than equal conflict resolution is to introduce a new non-terminal symbol so that the equals relation is turned into a less than relation. Thus, if we have the productions: and α A B β γ A C δ we would change the first production to α A B-
2 and add the production B- B β Thus, A is equal to B-, and A is less than B. Since B- only appears in the one production, there cannot be any other simple precedence conflicts between A and B-, and there will be no other production whose right hand side is α A B-. You do need to consider that there may be another production whose right hand side is B β. At this point you might try several other approaches to combine or substitute symbols while keeping the grammars similar. Greater Than, Equals ( >= ) Conflict In the greater than, equals conflict, we have V i >= V j. Remember that an equals relation is defined as: V i E V j holds if a right hand side of a production of the form V i V j where V i, V j V and, V *. and that a greater than relation is defined as: V i G V j holds if a right hand side of a production of the form V k V j and V k + V i or if a right hand side of a production of the form V k V l and V k + V i and V l + V j where V k, V l V n, V i, V j V, and,,, V *. Thus, if we have A = B and A > B, what we have is a right hand side of some production of the form α A B β, and either another production whose right hand side is γ C B δ where C + μ A or another production whose right hand side is γ C D δ where C + μ A and D + B σ. The general strategy for a greater than equal conflict resolution is to introduce a new non-terminal so that the equals relation is turned into a greater than relation. Thus, if we have the productions: and α A B β γ C B δ we would change the first production to A- B β and add the production A- α A Thus, A- is equal to B, and A is greater than B. Since A- only appears in the one production, there cannot be any other simple precedence conflicts between A- and B and there will be no other production whose right hand side is A- B β. You do need to check and make sure that there is no production whose right hand side is α A. If this is the case, than another attempt at splitting the α A B β right hand side so that A is not equal to B needs to be considered.
3 Less Than, Greater Than ( <> ) Conflict In the less than, greater than conflict, we have V i <> V j. Remember that a less than relation is defined as: V i L V j holds if a right hand side of a production of the form V i V k and V k + V j where V k V n, V i, V j V, and,, V *. and that a greater than relation is defined as: V i G V j holds if a right hand side of a production of the form V k V j and V k + V i or if a right hand side of a production of the form V k V l and V k + V i and V l + V j where V k, V l V n, V i, V j V, and,,, V *. Thus, if we have A < B and A > B, what we have is a right hand side of some production where α A C β where C + B and either another production whose right hand side is γ E B δ where E + μ A or another production whose right hand side is γ E D δ where E + μ A and D + B σ. The general strategy for a less than greater than conflict resolution is to introduce a new non-terminal symbol so that the less than relation is turned into a greater than relation. Thus, if we have the productions: and α A C β γ E B δ we would change the first production to A- C β and add the production A- α A Thus, A- is less than to B, and A is greater than B. Since A- only appears in the one production, there cannot be any other simple precedence conflicts between A- and B or A- and C. We also need to consider identical right hand sides as we did with the other conflict resolutions. Less than, Equals, Greater Than ( <=> ) Conflict In the less than, equals, greater than conflict, we have V i <=> V j. The general strategy is to first reduce the less than equals conflict so that you have only a less than greater than conflict. Then reduce the less than greater than conflict as described above. When I have been faced with this challenge in the past, I have found that adding one or two new terminal symbols makes the conflict resolution much easier. However, by adding any new terminal symbols, you have changed the language. Example Suppose that we have the following grammar. E E + T 2. T
4 3. T T * F 4. F 5. F P ^ F 6. P 7. P R & P 8. R 9. R V 0. ( E ) When we run the simple precedence analyzer, we get the simple precedence matrix for the above grammar below: E T F P R + * ^ v ( ) E..... =..... = 2 T..... G =.... G 3 F..... G G.... G 4 P..... G G 5... G 5 R..... G G G =.. G L L L.... L L. 7 *.. = L L.... L L. 8 ^.. = L L.... L L = L.... L L. 0 v..... G G G G.. G ( 4 L L L L.... L L. 2 )..... G G G G.. G Notice that there is a less than/equals, represented by 4, conflict between ( and E, and between + and T. There is also a greater than/equals, represented by 5, conflict between P and ^. Our standard approach is to remove the less than/equals conflict and then remove the greater than/equals conflict. Eliminating the less than/equals conflict we want to introduce a new non-terminal system and turn the equals relation into a less than relation. Hence, we will make the following changes to the grammar by introducing a new non-terminal E- and T- while keeping the language the same. Our new set of productions is. E E + T- 2. T 3. T T * F 4. F 5. F P ^ F 6. P
5 7. P R & P 8. R 9. R V 0. ( E- ). E- E 2. T- T where we have changed productions and 0 to eliminate the less than/equals conflicts and added productions and 2. We note that there are now two productions that have the same symbol on the RHS, namely productions 2 and 2. We see that we can change production 2 so that we have 2. E T- The resulting simple precedence matrix is E T E T F P R * ^ v ( ) E =..... G 2 T G =.... G 3 F G G.... G 4 P G G 5... G 5 R G G G =.. G 6 E = 7 T G..... G 8 +. L L L L. =.... L L. 9 *.. = L L L L. 0 ^.. = L L L L.... = L L L. 2 v G G G G.. G 3 ( L L L L L =..... L L. 4 ) G G G G.. G Notice that we only have the greater than/equals conflict between P and ^ in our grammar. Applying the idea that we want to change the equals relation into a greater than by introducing a new non-terminal symbol we might have the following grammar:. E E + T- 2. T- 3. T T * F 4. F 5. F P- ^ F 6. P
6 7. P R & P 8. R 9. R V 0. ( E- ). E- E 2. T- T 3. P- P where we have changed production 5 and added production 3. Again we see that we have two productions that have the same RHS, namely productions 6 and 3. Again, we change production 6 to 6. F P- The new simple precedence matrix is E T P E T F P R * ^ v ( ) E =..... G 2 T G =.... G 3 F G G.... G 4 P G G G... G 5 R G G G =.. G 6 E = 7 T G..... G 8 P = L L L L. = L.... L L. 0 *.. = L L.. L.... L L. ^.. = L L.. L.... L L = L L L. 3 v G G G G.. G 4 ( L L L L L =. L.... L L. 5 ) G G G G.. G We now have a simple precedence grammar whose language is the same as the grammar that we started with.
Nondeterminism. September 7, Nondeterminism
September 7, 204 Introduction is a useful concept that has a great impact on the theory of computation Introduction is a useful concept that has a great impact on the theory of computation So far in our
More informationA. Incorrect! This inequality is a disjunction and has a solution set shaded outside the boundary points.
Problem Solving Drill 11: Absolute Value Inequalities Question No. 1 of 10 Question 1. Which inequality has the solution set shown in the graph? Question #01 (A) x + 6 > 1 (B) x + 6 < 1 (C) x + 6 1 (D)
More informationShift-Reduce parser E + (E + (E) E [a-z] In each stage, we shift a symbol from the input to the stack, or reduce according to one of the rules.
Bottom-up Parsing Bottom-up Parsing Until now we started with the starting nonterminal S and tried to derive the input from it. In a way, this isn t the natural thing to do. It s much more logical to start
More informationDeterministic Finite Automata
Deterministic Finite Automata COMP2600 Formal Methods for Software Engineering Katya Lebedeva Australian National University Semester 2, 2016 Slides by Ranald Clouston and Katya Lebedeva. COMP 2600 Deterministic
More informationPushdown Automata (2015/11/23)
Chapter 6 Pushdown Automata (2015/11/23) Sagrada Familia, Barcelona, Spain Outline 6.0 Introduction 6.1 Definition of PDA 6.2 The Language of a PDA 6.3 Euivalence of PDA s and CFG s 6.4 Deterministic PDA
More informationEXAM. CS331 Compiler Design Spring Please read all instructions, including these, carefully
EXAM Please read all instructions, including these, carefully There are 7 questions on the exam, with multiple parts. You have 3 hours to work on the exam. The exam is open book, open notes. Please write
More informationProblem Session 5 (CFGs) Talk about the building blocks of CFGs: S 0S 1S ε - everything. S 0S0 1S1 A - waw R. S 0S0 0S1 1S0 1S1 A - xay, where x = y.
CSE2001, Fall 2006 1 Problem Session 5 (CFGs) Talk about the building blocks of CFGs: S 0S 1S ε - everything. S 0S0 1S1 A - waw R. S 0S0 0S1 1S0 1S1 A - xay, where x = y. S 00S1 A - xay, where x = 2 y.
More informationCreating a Recursive Descent Parse Table
Creating a Recursive Descent Parse Table Recursive descent parsing is sometimes called LL parsing (Left to right examination of input, Left derivation) Consider the following grammar E TE' E' +TE' T FT'
More informationAdministrivia. Test I during class on 10 March. Bottom-Up Parsing. Lecture An Introductory Example
Administrivia Test I during class on 10 March. Bottom-Up Parsing Lecture 11-12 From slides by G. Necula & R. Bodik) 2/20/08 Prof. Hilfinger CS14 Lecture 11 1 2/20/08 Prof. Hilfinger CS14 Lecture 11 2 Bottom-Up
More information(pp ) PDAs and CFGs (Sec. 2.2)
(pp. 117-124) PDAs and CFGs (Sec. 2.2) A language is context free iff all strings in L can be generated by some context free grammar Theorem 2.20: L is Context Free iff a PDA accepts it I.e. if L is context
More informationCFGs and PDAs are Equivalent. We provide algorithms to convert a CFG to a PDA and vice versa.
CFGs and PDAs are Equivalent We provide algorithms to convert a CFG to a PDA and vice versa. CFGs and PDAs are Equivalent We now prove that a language is generated by some CFG if and only if it is accepted
More informationDIFFERENTIATION AND INTEGRATION PART 1. Mr C s IB Standard Notes
DIFFERENTIATION AND INTEGRATION PART 1 Mr C s IB Standard Notes In this PDF you can find the following: 1. Notation 2. Keywords Make sure you read through everything and the try examples for yourself before
More informationComputability Theory
CS:4330 Theory of Computation Spring 2018 Computability Theory Decidable Problems of CFLs and beyond Haniel Barbosa Readings for this lecture Chapter 4 of [Sipser 1996], 3rd edition. Section 4.1. Decidable
More informationSolving Systems of Equations
Solving Systems of Equations Solving Systems of Equations What are systems of equations? Two or more equations that have the same variable(s) Solving Systems of Equations There are three ways to solve
More information6-3 Solving Systems by Elimination
Another method for solving systems of equations is elimination. Like substitution, the goal of elimination is to get one equation that has only one variable. To do this by elimination, you add the two
More informationCS 373: Theory of Computation. Fall 2010
CS 373: Theory of Computation Gul Agha Mahesh Viswanathan Fall 2010 1 1 Normal Forms for CFG Normal Forms for Grammars It is typically easier to work with a context free language if given a CFG in a normal
More informationChomsky Normal Form for Context-Free Gramars
Chomsky Normal Form for Context-Free Gramars Deepak D Souza Department of Computer Science and Automation Indian Institute of Science, Bangalore. 17 September 2014 Outline 1 CNF 2 Converting to CNF 3 Correctness
More information3.4 Exponential and Logarithmic Equations
3.4 Exponential and Logarithmic Equations Pre-Calculus Mr. Niedert Pre-Calculus 3.4 Exponential and Logarithmic Equations Mr. Niedert 1 / 18 3.4 Exponential and Logarithmic Equations 1 Solving Simple Equations
More informationChomsky and Greibach Normal Forms
Chomsky and Greibach Normal Forms Teodor Rus rus@cs.uiowa.edu The University of Iowa, Department of Computer Science Computation Theory p.1/25 Simplifying a CFG It is often convenient to simplify CFG One
More informationMTH401A Theory of Computation. Lecture 17
MTH401A Theory of Computation Lecture 17 Chomsky Normal Form for CFG s Chomsky Normal Form for CFG s For every context free language, L, the language L {ε} has a grammar in which every production looks
More informationCSE 105 THEORY OF COMPUTATION
CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/ Today's learning goals Sipser Ch 2 Define push down automata Trace the computation of a push down automaton Design
More informationCFG Simplification. (simplify) 1. Eliminate useless symbols 2. Eliminate -productions 3. Eliminate unit productions
CFG Simplification (simplify) 1. Eliminate useless symbols 2. Eliminate -productions 3. Eliminate unit productions 1 Eliminating useless symbols 1. A symbol X is generating if there exists: X * w, for
More information1. For the following sub-problems, consider the following context-free grammar: S AB$ (1) A xax (2) A B (3) B yby (5) B A (6)
ECE 468 & 573 Problem Set 2: Contet-free Grammars, Parsers 1. For the following sub-problems, consider the following contet-free grammar: S AB$ (1) A A (2) A B (3) A λ (4) B B (5) B A (6) B λ (7) (a) What
More informationContext-Free Grammar
Context-Free Grammar CFGs are more powerful than regular expressions. They are more powerful in the sense that whatever can be expressed using regular expressions can be expressed using context-free grammars,
More information(pp ) PDAs and CFGs (Sec. 2.2)
(pp. 117-124) PDAs and CFGs (Sec. 2.2) A language is context free iff all strings in L can be generated by some context free grammar Theorem 2.20: L is Context Free iff a PDA accepts it I.e. if L is context
More informationLecture 11 Sections 4.5, 4.7. Wed, Feb 18, 2009
The s s The s Lecture 11 Sections 4.5, 4.7 Hampden-Sydney College Wed, Feb 18, 2009 Outline The s s 1 s 2 3 4 5 6 The LR(0) Parsing s The s s There are two tables that we will construct. The action table
More informationRegular Expressions and Language Properties
Regular Expressions and Language Properties Mridul Aanjaneya Stanford University July 3, 2012 Mridul Aanjaneya Automata Theory 1/ 47 Tentative Schedule HW #1: Out (07/03), Due (07/11) HW #2: Out (07/10),
More informationIntroduction to Bottom-Up Parsing
Introduction to Bottom-Up Parsing Outline Review LL parsing Shift-reduce parsing The LR parsing algorithm Constructing LR parsing tables 2 Top-Down Parsing: Review Top-down parsing expands a parse tree
More informationPushdown Automata. Reading: Chapter 6
Pushdown Automata Reading: Chapter 6 1 Pushdown Automata (PDA) Informally: A PDA is an NFA-ε with a infinite stack. Transitions are modified to accommodate stack operations. Questions: What is a stack?
More informationV Honors Theory of Computation
V22.0453-001 Honors Theory of Computation Problem Set 3 Solutions Problem 1 Solution: The class of languages recognized by these machines is the exactly the class of regular languages, thus this TM variant
More informationIntroduction to Bottom-Up Parsing
Introduction to Bottom-Up Parsing Outline Review LL parsing Shift-reduce parsing The LR parsing algorithm Constructing LR parsing tables Compiler Design 1 (2011) 2 Top-Down Parsing: Review Top-down parsing
More informationcse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska
cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 6 CHAPTER 2 FINITE AUTOMATA 2. Nondeterministic Finite Automata NFA 3. Finite Automata and Regular Expressions 4. Languages
More informationLR(1) Parsers Part III Last Parsing Lecture. Copyright 2010, Keith D. Cooper & Linda Torczon, all rights reserved.
LR(1) Parsers Part III Last Parsing Lecture Copyright 2010, Keith D. Cooper & Linda Torczon, all rights reserved. LR(1) Parsers A table-driven LR(1) parser looks like source code Scanner Table-driven Parser
More informationOctober 6, Equivalence of Pushdown Automata with Context-Free Gramm
Equivalence of Pushdown Automata with Context-Free Grammar October 6, 2013 Motivation Motivation CFG and PDA are equivalent in power: a CFG generates a context-free language and a PDA recognizes a context-free
More informationThe Pumping Lemma for Context Free Grammars
The Pumping Lemma for Context Free Grammars Chomsky Normal Form Chomsky Normal Form (CNF) is a simple and useful form of a CFG Every rule of a CNF grammar is in the form A BC A a Where a is any terminal
More informationSolutions to Problem Set 3
V22.0453-001 Theory of Computation October 8, 2003 TA: Nelly Fazio Solutions to Problem Set 3 Problem 1 We have seen that a grammar where all productions are of the form: A ab, A c (where A, B non-terminals,
More informationAutomata Theory CS F-13 Unrestricted Grammars
Automata Theory CS411-2015F-13 Unrestricted Grammars David Galles Department of Computer Science University of San Francisco 13-0: Language Hierarchy Regular Languaes Regular Expressions Finite Automata
More informationMath 2 Variable Manipulation Part 1 Algebraic Equations
Math 2 Variable Manipulation Part 1 Algebraic Equations 1 PRE ALGEBRA REVIEW OF INTEGERS (NEGATIVE NUMBERS) Numbers can be positive (+) or negative (-). If a number has no sign it usually means that it
More informationIntroduction to Bottom-Up Parsing
Outline Introduction to Bottom-Up Parsing Review LL parsing Shift-reduce parsing he LR parsing algorithm Constructing LR parsing tables 2 op-down Parsing: Review op-down parsing expands a parse tree from
More informationParsing VI LR(1) Parsers
Parsing VI LR(1) Parsers N.B.: This lecture uses a left-recursive version of the SheepNoise grammar. The book uses a rightrecursive version. The derivations (& the tables) are different. Copyright 2005,
More informationIntroduction to Bottom-Up Parsing
Outline Introduction to Bottom-Up Parsing Review LL parsing Shift-reduce parsing he LR parsing algorithm Constructing LR parsing tables Compiler Design 1 (2011) 2 op-down Parsing: Review op-down parsing
More informationComputer Science 160 Translation of Programming Languages
Computer Science 160 Translation of Programming Languages Instructor: Christopher Kruegel Building a Handle Recognizing Machine: [now, with a look-ahead token, which is LR(1) ] LR(k) items An LR(k) item
More informationRadical Equations and Inequalities
16 LESSON Radical Equations and Inequalities Solving Radical Equations UNDERSTAND In a radical equation, there is a variable in the radicand. The radicand is the expression inside the radical symbol (
More information2.3 Solving Equations Containing Fractions and Decimals
2. Solving Equations Containing Fractions and Decimals Objectives In this section, you will learn to: To successfully complete this section, you need to understand: Solve equations containing fractions
More informationTop-Down Parsing and Intro to Bottom-Up Parsing
Predictive Parsers op-down Parsing and Intro to Bottom-Up Parsing Lecture 7 Like recursive-descent but parser can predict which production to use By looking at the next few tokens No backtracking Predictive
More informationParsing Algorithms. CS 4447/CS Stephen Watt University of Western Ontario
Parsing Algorithms CS 4447/CS 9545 -- Stephen Watt University of Western Ontario The Big Picture Develop parsers based on grammars Figure out properties of the grammars Make tables that drive parsing engines
More information1. For the following sub-problems, consider the following context-free grammar: S A$ (1) A xbc (2) A CB (3) B yb (4) C x (6)
ECE 468 & 573 Problem Set 2: Contet-free Grammars, Parsers (Solutions) 1. For the following sub-problems, consider the following contet-free grammar: S A$ (1) A C (2) A C (3) y (4) λ (5) C (6) (a) What
More informationA constant is a value that is always the same. (This means that the value is constant / unchanging). o
Math 8 Unit 7 Algebra and Graphing Relations Solving Equations Using Models We will be using algebra tiles to help us solve equations. We will practice showing work appropriately symbolically and pictorially
More informationSection 1 (closed-book) Total points 30
CS 454 Theory of Computation Fall 2011 Section 1 (closed-book) Total points 30 1. Which of the following are true? (a) a PDA can always be converted to an equivalent PDA that at each step pops or pushes
More informationCA Compiler Construction
CA4003 - Compiler Construction Bottom Up Parsing David Sinclair Bottom Up Parsing LL(1) parsers have enjoyed a bit of a revival thanks to JavaCC. LL(k) parsers must predict which production rule to use
More informationA linear equation in two variables is generally written as follows equation in three variables can be written as
System of Equations A system of equations is a set of equations considered simultaneously. In this course, we will discuss systems of equation in two or three variables either linear or quadratic or a
More informationHarvard CS 121 and CSCI E-207 Lecture 12: General Context-Free Recognition
Harvard CS 121 and CSCI E-207 Lecture 12: General Context-Free Recognition Salil Vadhan October 11, 2012 Reading: Sipser, Section 2.3 and Section 2.1 (material on Chomsky Normal Form). Pumping Lemma for
More informationThe trick is to multiply the numerator and denominator of the big fraction by the least common denominator of every little fraction.
Complex Fractions A complex fraction is an expression that features fractions within fractions. To simplify complex fractions, we only need to master one very simple method. Simplify 7 6 +3 8 4 3 4 The
More informationCPS 220 Theory of Computation
CPS 22 Theory of Computation Review - Regular Languages RL - a simple class of languages that can be represented in two ways: 1 Machine description: Finite Automata are machines with a finite number of
More informationReview of Rational Expressions and Equations
Page 1 of 14 Review of Rational Epressions and Equations A rational epression is an epression containing fractions where the numerator and/or denominator may contain algebraic terms 1 Simplify 6 14 Identification/Analysis
More informationOptimizing Finite Automata
Optimizing Finite Automata We can improve the DFA created by MakeDeterministic. Sometimes a DFA will have more states than necessary. For every DFA there is a unique smallest equivalent DFA (fewest states
More informationA. Incorrect! Replacing is not a method for solving systems of equations.
ACT Math and Science - Problem Drill 20: Systems of Equations No. 1 of 10 1. What methods were presented to solve systems of equations? (A) Graphing, replacing, and substitution. (B) Solving, replacing,
More informationTop-Down Parsing, Part II
op-down Parsing, Part II Announcements Programming Project 1 due Friday, 11:59PM Office hours every day until then. ubmission instructions will be emailed out tonight. Where We Are ource Code Lexical Analysis
More informationContext Free Grammars: Introduction. Context Free Grammars: Simplifying CFGs
Context Free Grammars: Introduction CFGs are more powerful than RGs because of the following 2 properties: 1. Recursion Rule is recursive if it is of the form X w 1 Y w 2, where Y w 3 Xw 4 and w 1, w 2,
More informationECS120 Fall Discussion Notes. October 25, The midterm is on Thursday, November 2nd during class. (That is next week!)
ECS120 Fall 2006 Discussion Notes October 25, 2006 Announcements The midterm is on Thursday, November 2nd during class. (That is next week!) Homework 4 Quick Hints Problem 1 Prove that the following languages
More informationSIXTH FORM MATHEMATICS A LEVEL INDUCTION BOOKLET SEPTEMBER Name:
SIXTH FORM MATHEMATICS A LEVEL INDUCTION BOOKLET SEPTEMBER 014 Name: INTRODUCTION TO A LEVEL MATHS Thank you for choosing to study Mathematics in the sixth form at Chelsea Academy. In year 1 you will sit
More informationThe Pumping Lemma. for all n 0, u 1 v n u 2 L (i.e. u 1 u 2 L, u 1 vu 2 L [but we knew that anyway], u 1 vvu 2 L, u 1 vvvu 2 L, etc.
The Pumping Lemma For every regular language L, there is a number l 1 satisfying the pumping lemma property: All w L with w l can be expressed as a concatenation of three strings, w = u 1 vu 2, where u
More informationLECTURE 10: REVIEW OF POWER SERIES. 1. Motivation
LECTURE 10: REVIEW OF POWER SERIES By definition, a power series centered at x 0 is a series of the form where a 0, a 1,... and x 0 are constants. For convenience, we shall mostly be concerned with the
More informationModeling Symmetries for Stochastic Structural Recognition
Modeling Symmetries for Stochastic Structural Recognition Second International Workshop on Stochastic Image Grammars Barcelona, November 2011 Radim Tyleček and Radim Šára tylecr1@cmp.felk.cvut.cz Center
More informationREGular and Context-Free Grammars
REGular and Context-Free Grammars Nicholas Mainardi 1 Dipartimento di Elettronica e Informazione Politecnico di Milano nicholas.mainardi@polimi.it March 26, 2018 1 Partly Based on Alessandro Barenghi s
More information1. For the following sub-problems, consider the following context-free grammar: S AA$ (1) A xa (2) A B (3) B yb (4)
ECE 468 & 573 Problem Set 2: Contet-free Grammars, Parsers 1. For the following sub-problems, consider the following contet-free grammar: S $ (1) (2) (3) (4) λ (5) (a) What are the terminals and non-terminals
More informationLecture 12 Simplification of Context-Free Grammars and Normal Forms
Lecture 12 Simplification of Context-Free Grammars and Normal Forms COT 4420 Theory of Computation Chapter 6 Normal Forms for CFGs 1. Chomsky Normal Form CNF Productions of form A BC A, B, C V A a a T
More informationx y = 2 x + 2y = 14 x = 2, y = 0 x = 3, y = 1 x = 4, y = 2 x = 5, y = 3 x = 6, y = 4 x = 7, y = 5 x = 0, y = 7 x = 2, y = 6 x = 4, y = 5
List six positive integer solutions for each of these equations and comment on your results. Two have been done for you. x y = x + y = 4 x =, y = 0 x = 3, y = x = 4, y = x = 5, y = 3 x = 6, y = 4 x = 7,
More informationRules for Assigning Oxidation Numbers. 1. The oxidation number of an element in any elementary substance is zero.
Rules for Assigning Oxidation Numbers 1. The oxidation number of an element in any elementary substance is zero. For example, the oxidation number of chlorine in Cl 2, phosphorus in P 4, and sulfur in
More informationCSCI Compiler Construction
CSCI 742 - Compiler Construction Lecture 12 Cocke-Younger-Kasami (CYK) Algorithm Instructor: Hossein Hojjat February 20, 2017 Recap: Chomsky Normal Form (CNF) A CFG is in Chomsky Normal Form if each rule
More informationWhy? 2.2. What Do You Already Know? 2.2. Goals 2.2. Building Mathematical Language 2.2. Key Concepts 2.2
Section. Solving Basic Equations Why. You can solve some equations that arise in the real world by isolating a variable. You can use this method to solve the equation 1 400 + 1 (10) x = 460 to determine
More informationwe first add 7 and then either divide by x - 7 = 1 Adding 7 to both sides 3 x = x = x = 3 # 8 1 # x = 3 # 4 # 2 x = 6 1 =?
. Using the Principles Together Applying Both Principles a Combining Like Terms a Clearing Fractions and Decimals a Contradictions and Identities EXAMPLE Solve: An important strategy for solving new problems
More informationParsing -3. A View During TD Parsing
Parsing -3 Deterministic table-driven parsing techniques Pictorial view of TD and BU parsing BU (shift-reduce) Parsing Handle, viable prefix, items, closures, goto s LR(k): SLR(1), LR(1) Problems with
More informationStructural Induction
Structural Induction In this lecture we ll extend the applicability of induction to many universes, ones where we can define certain kinds of objects by induction, in addition to proving their properties
More informationPolynomial and Synthetic Division
Polynomial and Synthetic Division Polynomial Division Polynomial Division is very similar to long division. Example: 3x 3 5x 3x 10x 1 3 Polynomial Division 3x 1 x 3x 3 3 x 5x 3x x 6x 4 10x 10x 7 3 x 1
More informationCS 322 D: Formal languages and automata theory
CS 322 D: Formal languages and automata theory Tutorial NFA DFA Regular Expression T. Najla Arfawi 2 nd Term - 26 Finite Automata Finite Automata. Q - States 2. S - Alphabets 3. d - Transitions 4. q -
More informationParsing. Context-Free Grammars (CFG) Laura Kallmeyer. Winter 2017/18. Heinrich-Heine-Universität Düsseldorf 1 / 26
Parsing Context-Free Grammars (CFG) Laura Kallmeyer Heinrich-Heine-Universität Düsseldorf Winter 2017/18 1 / 26 Table of contents 1 Context-Free Grammars 2 Simplifying CFGs Removing useless symbols Eliminating
More informationCPSC 313 Introduction to Computability
CPSC 313 Introduction to Computability Grammars in Chomsky Normal Form (Cont d) (Sipser, pages 109-111 (3 rd ed) and 107-109 (2 nd ed)) Renate Scheidler Fall 2018 Chomsky Normal Form A context-free grammar
More informationLecture Notes on Inductive Definitions
Lecture Notes on Inductive Definitions 15-312: Foundations of Programming Languages Frank Pfenning Lecture 2 August 28, 2003 These supplementary notes review the notion of an inductive definition and give
More informationPlan for 2 nd half. Just when you thought it was safe. Just when you thought it was safe. Theory Hall of Fame. Chomsky Normal Form
Plan for 2 nd half Pumping Lemma for CFLs The Return of the Pumping Lemma Just when you thought it was safe Return of the Pumping Lemma Recall: With Regular Languages The Pumping Lemma showed that if a
More informationContext-free Grammars and Languages
Context-free Grammars and Languages COMP 455 002, Spring 2019 Jim Anderson (modified by Nathan Otterness) 1 Context-free Grammars Context-free grammars provide another way to specify languages. Example:
More informationDefinition of a Logarithm
Chapter 17 Logarithms Sec. 1 Definition of a Logarithm In the last chapter we solved and graphed exponential equations. The strategy we used to solve those was to make the bases the same, set the exponents
More informationSolution. S ABc Ab c Bc Ac b A ABa Ba Aa a B Bbc bc.
Section 12.4 Context-Free Language Topics Algorithm. Remove Λ-productions from grammars for langauges without Λ. 1. Find nonterminals that derive Λ. 2. For each production A w construct all productions
More informationNotes on Pumping Lemma
Notes on Pumping Lemma Finite Automata Theory and Formal Languages TMV027/DIT321 Ana Bove, March 5th 2018 In the course we see two different versions of the Pumping lemmas, one for regular languages and
More informationLecture VII Part 2: Syntactic Analysis Bottom-up Parsing: LR Parsing. Prof. Bodik CS Berkley University 1
Lecture VII Part 2: Syntactic Analysis Bottom-up Parsing: LR Parsing. Prof. Bodik CS 164 -- Berkley University 1 Bottom-Up Parsing Bottom-up parsing is more general than topdown parsing And just as efficient
More informationMAIDSTONE GRAMMAR SCHOOL FOR GIRLS
MAIDSTONE GRAMMAR SCHOOL FOR GIRLS King Edward VI High School DEPARTMENT OF MATHEMATICS Introduction to A level Maths INDUCTION BOOKLET CONTENTS Reading List... 3 Section 1: FRACTIONS... 4 Section : EXPANDING...
More informationContext Free Grammars: Introduction
Context Free Grammars: Introduction Context free grammar (CFG) G = (V, Σ, R, S), where V is a set of grammar symbols Σ V is a set of terminal symbols R is a set of rules, where R (V Σ) V S is a distinguished
More informationNotes for Comp 497 (Comp 454) Week 10 4/5/05
Notes for Comp 497 (Comp 454) Week 10 4/5/05 Today look at the last two chapters in Part II. Cohen presents some results concerning context-free languages (CFL) and regular languages (RL) also some decidability
More informationNote: An algebraic expression is made of one or more terms. The terms in an algebraic expression are connected with either addition or subtraction.
.4 Combining Like Terms Term A term is a single number or variable, or it can be a product of a number (called its coefficient) and one or more variables. Examples of terms:, x, a, xy, 4 a bc, 5, xyz coefficient
More informationFormal Definition of Computation. August 28, 2013
August 28, 2013 Computation model The model of computation considered so far is the work performed by a finite automaton Finite automata were described informally, using state diagrams, and formally, as
More informationCSCI3390-Assignment 2 Solutions
CSCI3390-Assignment 2 Solutions due February 3, 2016 1 TMs for Deciding Languages Write the specification of a Turing machine recognizing one of the following three languages. Do one of these problems.
More informationChapter 3. September 11, ax + b = 0.
Chapter 3 September 11, 2017 3.1 Solving equations Solving Linear Equations: These are equations that can be written as ax + b = 0. Move all the variables to one side of the equation and all the constants
More informationWeek 2. Topic 4 Domain and Range
Week 2 Topic 4 Domain and Range 1 Week 2 Topic 4 Domain and Range Introduction A function is a rule that takes an input and produces one output. If we want functions to represent real-world situations,
More informationEinführung in die Computerlinguistik
Einführung in die Computerlinguistik Context-Free Grammars formal properties Laura Kallmeyer Heinrich-Heine-Universität Düsseldorf Summer 2018 1 / 20 Normal forms (1) Hopcroft and Ullman (1979) A normal
More informationLR(1) Parsers Part II. Copyright 2010, Keith D. Cooper & Linda Torczon, all rights reserved.
LR(1) Parsers Part II Copyright 2010, Keith D. Cooper & Linda Torczon, all rights reserved. LR(1) Parsers A table-driven LR(1) parser looks like source code Scanner Table-driven Parser IR grammar Parser
More informationSTEP Support Programme. Hints and Partial Solutions for Assignment 17
STEP Support Programme Hints and Partial Solutions for Assignment 7 Warm-up You need to be quite careful with these proofs to ensure that you are not assuming something that should not be assumed. For
More informationNumerical Methods Lecture 2 Simultaneous Equations
Numerical Methods Lecture 2 Simultaneous Equations Topics: matrix operations solving systems of equations pages 58-62 are a repeat of matrix notes. New material begins on page 63. Matrix operations: Mathcad
More informationSymbolic Logic 3. For an inference to be deductively valid it is impossible for the conclusion to be false if the premises are true.
Symbolic Logic 3 Testing deductive validity with truth tables For an inference to be deductively valid it is impossible for the conclusion to be false if the premises are true. So, given that truth tables
More informationOgden s Lemma for CFLs
Ogden s Lemma for CFLs Theorem If L is a context-free language, then there exists an integer l such that for any u L with at least l positions marked, u can be written as u = vwxyz such that 1 x and at
More informationDefinition: Absolute Value The absolute value of a number is the distance that the number is from zero. The absolute value of x is written x.
R. Absolute Values We begin this section by recalling the following definition. Definition: Absolute Value The absolute value of a number is the distance that the number is from zero. The absolute value
More information