Stdnt id: roll no..

Slides:



Advertisements
Similar presentations
CS 101 Attendance 3/27/14. A query using “AND” will A.Generate more answers than the same thing with OR B.Generate fewer answers than the same query with.
Advertisements

Lecture # 8 Chapter # 4: Syntax Analysis. Practice Context Free Grammars a) CFG generating alternating sequence of 0’s and 1’s b) CFG in which no consecutive.
Prime and Composite Numbers
Prime and Composite Factors: – When 2 or more numbers are multiplied, each number is called a factor of the product Ex) 1 x 5 = 52 x 5 = 10 1 x 10 = 10.
Western Michigan University CS6800 Advanced Theory of Computation Spring 2014 By Abduljaleel Alhasnawi & Rihab Almalki.
CS5371 Theory of Computation
Transparency No. P2C4-1 Formal Language and Automata Theory Part II Chapter 4 Parse Trees and Parsing.
Introduction to the Theory of Computation John Paxton Montana State University Summer 2003.
Lecture 13 Parsing and Ambiguity. Given a string x and a CFG G = (V, Σ, R, S), determine whether x L(G) and if x L(G), find a derivation S * x. This problem.
CISC 471 First Exam Review Game Questions. Overview 1 Draw the standard phases of a compiler for compiling a high level language to machine code, showing.
Context-free Grammars Example : S   Shortened notation : S  aSaS   | aSa | bSb S  bSb Which strings can be generated from S ? [Section 6.1]
Syntax Analysis The recognition problem: given a grammar G and a string w, is w  L(G)? The parsing problem: if G is a grammar and w  L(G), how can w.
Context-free Grammars [Section 2.1] - more powerful than regular languages - originally developed by linguists - important for compilation of programming.
Classification of grammars Definition: A grammar G is said to be 1)Right-linear if each production in P is of the form A  xB or A  x where A and B are.
Lecture # 19. Example Consider the following CFG ∑ = {a, b} Consider the following CFG ∑ = {a, b} 1. S  aSa | bSb | a | b | Λ The above CFG generates.
Chapter 5 Context-Free Grammars
Lecture # 9 Chap 4: Ambiguous Grammar. 2 Chomsky Hierarchy: Language Classification A grammar G is said to be – Regular if it is right linear where each.
Dept. of Computer Science & IT, FUUAST Automata Theory 2 Automata Theory V Context-Free Grammars andLanguages.
Context Free Grammar. Introduction Why do we want to learn about Context Free Grammars?  Used in many parsers in compilers  Yet another compiler-compiler,
CS 3240: Languages and Computation Context-Free Languages.
Lecture 11 Theory of AUTOMATA
Copyright © 2011 Pearson, Inc. 5.5 Law of Sines Goal: Solve triangles that have no solution, one solution, or two solutions.
Chapter 3 Context-Free Grammars Dr. Frank Lee. 3.1 CFG Definition The next phase of compilation after lexical analysis is syntax analysis. This phase.
Introduction Finite Automata accept all regular languages and only regular languages Even very simple languages are non regular (  = {a,b}): - {a n b.
Dept. of Computer Science & IT, FUUAST Theory of Computation 2 Regular Expressions Regular Expression.
Lecture 15 Ambiguous Grammars Topics: Context Free Grammars Language generated by a grammar Proofs with L(G) Ambiguous grammars October 20, 2008 CSCE 355.
Lecture 17: Theory of Automata:2014 Context Free Grammars.
Describing Syntax and Semantics Chapter 3: Describing Syntax and Semantics Lectures # 6.
Basic derivation rules We will generally have to confront not only the functions presented above, but also combinations of these : multiples, sums, products,
Lecture 7 Syntax Analysis (5) Operator-Precedence Parsing
5. Context-Free Grammars and Languages
Chapter 3: Describing Syntax and Semantics
Chapter 1: Definitions, Families of Curves
ECE 3301 General Electrical Engineering
Formal Language & Automata Theory
CS510 Compiler Lecture 4.
Context-free grammars, derivation trees, and ambiguity
Recap lecture 33 Example of trees, Polish Notation, examples, Ambiguous CFG, example,
Recap Lecture 34 Example of Ambiguous Grammar, Example of Unambiguous Grammer (PALINDROME), Total Language tree with examples (Finite and infinite trees),
Even-Even Devise a grammar that generates strings with even number of a’s and even number of b’s.
Theory Of Automata By Dr. MM Alam
FORMAL LANGUAGES AND AUTOMATA THEORY
Context Free Languages
Parsing Techniques.
Lecture 14 Grammars – Parse Trees– Normal Forms
Jaya Krishna, M.Tech, Assistant Professor
Context-Free Languages
Department of Software & Media Technology
Relationship to Left- and Rightmost Derivations
Programming Language Syntax 2
Context-free Languages
TaBle-driven LL(1) Parsing
5. Context-Free Grammars and Languages
Chapter 2: A Simple One Pass Compiler
Section 2.4 Symmetry.
TaBle-driven LL(1) Parsing
Finite Automata and Formal Languages
L1-3 Notes: Prime Factors
Itcoinitcoin ASAS. 4 I4 I,
Derivations and Languages
Relationship to Left- and Rightmost Derivations
Theory of Computation Lecture #
Chapter 2 Context-Free Language - 02
USING AMBIGUOUS GRAMMARS
Task Construct CFG that generates the language L = {w  {a,b}*: length(w)  2 and second letter of w from right is a}
COSC 3340: Introduction to Theory of Computation
LANGUAGE EDUCATION.
Context Free Grammars-II
Answer Questions about Exam2 problems
ASADASF ASSAAS.
Presentation transcript:

Stdnt id: roll no.

Ambiguous CFG: The CFG is Said to be Ambiguous if There exist at least one word of it’s language that it can be generated by the Different production trees.

Example: Consider The Following CFG S as|Sa|a The Words aan can be generated by the Following three different Trees Examples: S S S a a S a S S a S S a S a a a a

Thus the above CFG is ambiguous, while CFG, S aS|a is not ambiguous as Neither the word aaa nor any other word can be Derived from more then one Production Trees. The derivation tree for aaa is as follows. S S a a S a