CST229 Week 7 Questions or concerns? Hand back Test#1 & Homework #4 – Test1 Average (45/50) Reading: Chapters 12&13 Chapter 12 – Grammar – production rules.

Slides:



Advertisements
Similar presentations
Theory Of Automata By Dr. MM Alam
Advertisements

L ECTURE 3 T HEORY OF AUTOMATA. E QUIVALENT R EGULAR E XPRESSIONS Definition Two regular expressions are said to be equivalent if they generate the same.
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.
About Grammars CS 130 Theory of Computation HMU Textbook: Sec 7.1, 6.3, 5.4.
Dept. of Computer Science & IT, FUUAST Automata Theory 2 Automata Theory VII.
CS 3240 – Chapter 6.  6.1: Simplifying Grammars  Substitution  Removing useless variables  Removing λ  Removing unit productions  6.2: Normal Forms.
CS5371 Theory of Computation
1 CSC 3130: Automata theory and formal languages Tutorial 4 KN Hung Office: SHB 1026 Department of Computer Science & Engineering.
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University.
1 、 Alphabet Non-empty set of symbols , usually expressed in  、 V or Other Upper-case Greece Letter 2 、 Symbol(Character) Elements in alphabet, finest.
1 Context-Free Languages. 2 Regular Languages 3 Context-Free Languages.
Finite Automata Chapter 5. Formal Language Definitions Why need formal definitions of language –Define a precise, unambiguous and uniform interpretation.
Context-Free Grammars Chapter 3. 2 Context-Free Grammars and Languages n Defn A context-free grammar is a quadruple (V, , P, S), where  V is.
Theory Of Automata By Dr. MM Alam
Problem of the DAY Create a regular context-free grammar that generates L= {w  {a,b}* : the number of a’s in w is not divisible by 3} Hint: start by designing.
Context-Free Grammars
Formal Grammars Denning, Sections 3.3 to 3.6. Formal Grammar, Defined A formal grammar G is a four-tuple G = (N,T,P,  ), where N is a finite nonempty.
1 Week 3 Questions / Concerns What’s due: Lab1b due Friday at midnight Lab1b check-off next week (schedule will be announced on Monday) Homework #2 due.
1 Syntax Specification Regular Expressions. 2 Phases of Compilation.
CSCI 2670 Introduction to Theory of Computing September 21, 2004.
1 Language Definitions Lecture # 2. Defining Languages The languages can be defined in different ways, such as Descriptive definition, Recursive definition,
Recap Lecture-2 Kleene Star Closure, Plus operation, recursive definition of languages, INTEGER, EVEN, factorial, PALINDROME, {anbn}, languages of strings.
Lecture # 3 Regular Expressions 1. Introduction In computing, a regular expression provides a concise and flexible means to "match" (specify and recognize)
1 Context-Free Languages Not all languages are regular. L 1 = {a n b n | n  0} is not regular. L 2 = {(), (()), ((())),...} is not regular.  some properties.
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.
Languages & Grammars. Grammars  A set of rules which govern the structure of a language Fritz Fritz The dog The dog ate ate left left.
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,
Module 2 How to design Computer Language Huma Ayub Software Construction Lecture 8.
L ECTURE 3 Chapter 4 Regular Expressions. I MPORTANT T ERMS Regular Expressions Regular Languages Finite Representations.
Introduction to Theory of Automata By: Wasim Ahmad Khan.
CST229 Week 4 Questions or concerns? Test#1 next Thursday Homework #3 due Hand back Homework #2 Reading: Chapters 5 & 7 In-Class Exercise #4a Chapter 5.
Regular Grammars Chapter 7. Regular Grammars A regular grammar G is a quadruple (V, , R, S), where: ● V is the rule alphabet, which contains nonterminals.
Homework #3 J. H. Wang Nov. 1, Homework #3 Chap. 4 –4.1 (c) –4.7 (c) –4.8 (a)(b)(c) –4.11.
Regular Grammars Chapter 7 1. Regular Grammars A regular grammar G is a quadruple (V, , R, S), where: ● V is the rule alphabet, which contains nonterminals.
1 A well-parenthesized string is a string with the same number of (‘s as )’s which has the property that every prefix of the string has at least as many.
1 Simplification of Context-Free Grammars Some useful substitution rules. Removing useless productions. Removing -productions. Removing unit-productions.
1 Week 6 Questions / Concerns What’s due: Lab2 part b due on Friday HW#5 due on Thursday Coming up: Project posted. You can work in pairs. Lab2 part b.
1 Week 5 Questions / Concerns What’s due: Lab2 part a due on Sunday Lab1 check-off by appointment Test#1 HW#5 next Thursday Coming up: Lab3 Posted. Discuss.
1 Chapter 6 Simplification of CFGs and Normal Forms.
CST229 Week 8 Questions or concerns? Hand back Homework #6 & #5 Reading: Chapter 14 Comment about Lab1 Getting started with Lab2 Chapter 14 – Regular Grammar.
CST229 Week 2 Questions or concern? Homework #1 due – Difference between permutation and no restrictions on using an element more than once. Code example:
CSC312 Automata Theory Lecture # 26 Chapter # 12 by Cohen Context Free Grammars.
Lecture # Book Introduction to Theory of Computation by Anil Maheshwari Michiel Smid, 2014 “Introduction to computer theory” by Daniel I.A. Cohen.
Lecture # 4.
Mathematical Foundations of Computer Science Chapter 3: Regular Languages and Regular Grammars.
Chapter 4: Syntax analysis Syntax analysis is done by the parser. –Detects whether the program is written following the grammar rules and reports syntax.
Lecture 2 Theory of AUTOMATA
Transparency No. 1 Formal Language and Automata Theory Homework 5.
1 A well-parenthesized string is a string with the same number of (‘s as )’s which has the property that every prefix of the string has at least as many.
Compiler Construction Lecture Five: Parsing - Part Two CSC 2103: Compiler Construction Lecture Five: Parsing - Part Two Joyce Nakatumba-Nabende 1.
Lecture 03: Theory of Automata:2014 Asif Nawaz Theory of Automata.
1 1. Eliminate all  -transitions from the following FA without changing the number of states and the language accepted by the automaton. You should also.
Lecture # 8 (Transition Graphs). Example Consider the language L of strings, defined over Σ={a, b}, having (containing) triple a or triple b. Consider.
Recap Lecture 3 RE, Recursive definition of RE, defining languages by RE, { x}*, { x}+, {a+b}*, Language of strings having exactly one aa, Language of.
Recap lecture 5 Different notations of transition diagrams, languages of strings of even length, Odd length, starting with b, ending in a (with different.
CST229 Week 6 Questions or concerns? Homework #4 due
Theory of Computation Lecture #
Lecture # 2.
Regular Expressions (Examples)
Even-Even Devise a grammar that generates strings with even number of a’s and even number of b’s.
FORMAL LANGUAGES AND AUTOMATA THEORY
Jaya Krishna, M.Tech, Assistant Professor
Chapter 7 Regular Grammars
Homework #5 (Models of Computation, Spring, 2001) Due: Section 1; February 27 Section 2; February 28 ** Please put your homework in the collection.
CSC312 Automata Theory Lecture # 3 Languages-II.
Recap Lecture 3 RE, Recursive definition of RE, defining languages by RE, { x}*, { x}+, {a+b}*, Language of strings having exactly one aa, Language of.
LECTURE # 07.
Presentation transcript:

CST229 Week 7 Questions or concerns? Hand back Test#1 & Homework #4 – Test1 Average (45/50) Reading: Chapters 12&13 Chapter 12 – Grammar – production rules – Derivation/Parse Tree – How to tell if a grammar is ambiguous In-Class Exercise #5 part 1 Chapter 13 – Regular Grammar Production rules – Remove Lambda productions – Remove Unit productions In-Class Exercise #5 part 2

In-Class Exercise #5 part 1 Construct Grammar Production Rules for the following: All words over {a,b} in which the letter a is never tripled. (i.e. no aaa allowed) L = {a n b m | 2n <= m <= 3n} L = {a n b m c k | m = 3k} L = {a n b m c k | m = n+k}

In-Class Exercise #5 part 2 Define a regular grammar for these languages: – All strings over {a,b} with 2 or 3 b’s and no more. – (a+b)*ab(a+b)* Remove lambda and unit productions from this grammar: S-> aA | aaB A-> aaA | aC | B -> C | bbB C -> cC | c