Formal Grammars and Abstract Machines. Sahar Al Seesi
|
|
- Rosemary King
- 5 years ago
- Views:
Transcription
1 Formal Grammars and Abstract Machines Sahar Al Seesi
2 What are Formal Languages Describing the sentence structure of a language in a formal way Used in Natural Language Processing Applications (translators, grammar checking tools, etc..) Language: English, French, Spanish, Chinese, etc.. RNA/Protein Structure Analysis RNA in general, ribosomal RNA, protein, etc.. Compilers for programming languages C, Java, Python, Linux shell script, Assembly, etc.. To build a program for any of the above applications, the language rules must be described in a formal inclusive way.
3 Formal Languages and Grammars G={ Σ, R, S } Σ : Non-terminals (NT) Terminals (T) {S, VERB, SUBJECT, OBJECT} {S, A, A 2 } R : Production rules {S SUBJECT VERB OBJECT} S : Starting symbol {children, sam, play, eat, ball} {a, c, g, t} {a,c,g,u} L(G) : The language defined by G; a finite or infinite set of strings (words/sentences) L(G) T*
4 Power of expression Rule complexity Parsing time complexity Chomsky Hierarchy Unrestricted Grammars Recursively Enumerable Languages Context-sensitive Context-free Regular
5 Parsing/Accepting Abstract Machines Grammar Regular grammars Context free grammars Context sensitive grammars Unrestricted grammars Parsing Automaton Finite State Machine (FSM) Push-Down Automaton (PDA) Linear-Bounded Automaton (LBA) Turing Machine (TM)
6 Regular Languages & Regular Expressions A regular language can be represented by a regular expression Let Σ = {a,b} Let L r be the language defined by regular expression r. r L r Σ* the set of all strings over Σ of length or more (includes the empty string, ) Σ + the set of all strings over Σ of length or more (does not include ) a+ the set of all strings of or more a s {a, aa, aaa, } b* the set of all strings of or more b s {, b, bb, bbb, }
7 Combining Regular Languages Concatenation Let r and s be 2 regular expressions, rs corresponds to the language L r L s Example: r = a*, s = b + L r L s : the set of strings consisting of or more a s followed by or more b s {b, bb, ab, aabbbb} L r L s
8 Combining Regular Languages Union Let r and s be 2 regular expressions, r+s corresponds to the language L r L s Example: r = a*, s = b + L r L s : the set of strings consisting of or more a s and strings of or more b s {b, bb, a, aa, bbbb} L r L s
9 Combining Regular Languages Closure Let r be a regular expression, r* corresponds to the language L r * Example: r = ab L r * : the set of strings consisting of or more ab s (ab)* {, ab, abab, abab, ababab} L r *
10 Example R = (a+c+t)ykk(p+q)*vdt(l+z+ )pq Strings that belong to the language defined by R ayykppvdtlpq cyykpqppqvdtpq tyykqvdtzpq
11 Regular Grammars Can be represented by a regular expression Grammar rules are of the form NT T NT NT T Example: The set of all DNA strings Regular Expression: {a,c,g,t} + G= { Σ, {S}, R, S } Σ = {S, a, c, g, t} R = {S as cs gs ts a c g t}
12 Finite State Machine M={Q, Σ,, q, F} Q: Finite set of states Σ: Language alphabet : Transition function (Qx Σ Q) q : Starting state F : Set of final states
13 Finite State Machine Example M={Q, Σ,, q, F} A FSM for R = {S as cs gs ts a c g t} a,c,g,t a,c,g,t 2 Q = {,2} Σ = {a, c, g, t} q = F = {2} (,a) = 2 (,c) = 2 (,g) = 2 (,t) = 2 (2,a) = 2 (2,c) = 2 (2,g) = 2 (2,t) = 2
14 Another Example L = The set of all strings in {,}*that either begin or end (or both) with R = ((+)*)+((+)*) S C A D B E, Input:
15 Another Example L = The set of all strings in {,}*that either begin or end (or both) with R = ((+)*)+((+)*) S C A D B E, Input:
16 Another Example L = The set of all strings in {,}*that either begin or end (or both) with R = ((+)*)+((+)*) S C A D B E, Input:
17 Another Example L = The set of all strings in {,}*that either begin or end (or both) with R = ((+)*)+((+)*) S C A D B E, Input:
18 Another Example L = The set of all strings in {,}*that either begin or end (or both) with R = ((+)*)+((+)*) S C A D B E, Input:
19 Another Example L = The set of all strings in {,}*that either begin or end (or both) with R = ((+)*)+((+)*) S C A D B E, Input:
20 Another Example L = The set of all strings in {,}*that either begin or end (or both) with R = ((+)*)+((+)*) S C A D B E, Input2:
21 Another Example L = The set of all strings in {,}*that either begin or end (or both) with R = ((+)*)+((+)*) S C A D B E, Input2:
22 Another Example L = The set of all strings in {,}*that either begin or end (or both) with R = ((+)*)+((+)*) S C A D B E, Input2:
23 Another Example L = The set of all strings in {,}*that either begin or end (or both) with R = ((+)*)+((+)*) S C A D B E, Input2:
24 Another Example L = The set of all strings in {,}*that either begin or end (or both) with R = ((+)*)+((+)*) S C A D B E, Input2:
25 Another Example L = The set of all strings in {,}*that either begin or end (or both) with R = ((+)*)+((+)*) S C A D B E, Input2:
26 Another Example L = The set of all strings in {,}*that either begin or end (or both) with R = ((+)*)+((+)*) S C A D B E, Input3:
27 Another Example L = The set of all strings in {,}*that either begin or end (or both) with R = ((+)*)+((+)*) S C A D B E, Input3:
28 Context Free Grammars (CFG) and Languages CFGs Can represent nested pair-wise correlation between terminal symbols in the string Famous example: palindrome language (ww r ) a b a a a a b a Can you write a regular grammar for ww r? Grammar rules are of the form NT (T+NT) +
29 CFG and Push Down Automata M={Q, Σ,,, q, F} Q: Finite set of states Σ: Language alphabet : Stack alphabet : Transition function (Q x Σ x Q x *) q : Starting state F : Set of final states
30 Grammar ww r G={ Σ, V, R, S } Σ = {a, b}, V = {S} R = {S asa bsb aa bb} Parse tree for string: abbbba S a S a b S b b b
31 Context Free Grammar for an RNA stem loop Language : wvw cr G={ Σ, R, S } Σ = {S, L, a, c, g, u} R = {S asu usa gsc csg L, L al cl gl ul a c g u} Durbin et. al., Biological Sequence Analysis, adapted
32 Context Sensitive Grammars and Languages Can represent crossing pair-wise correlation between terminal symbols in the string Famous example: copy language (ww) a a b b a a b b Grammar rules are of the form: (T+NT) * NT (T+NT) * (T+NT) + LHS <= RHS (generated RHS cannot shrink from one production step to the next)
33 CSG and Linear Bounded Automata SKIP FOR NOW
34 Non-deterministic and stochastic models A stochastic grammar has a probability associated with each rule in the grammar Similarly, in automata, a probability would be associated with each transition
35 Unrestricted Grammars and Recursively Enumerable Languages Grammar rules are of the form: - (T+NT) * NT (T+NT) * (T+NT) * - The only rule is that the left hand side must contain at least one variable A recursively enumerable language is one that can be represented by an unrestricted grammar
36 Turing Machines M={Q, Σ,,, q, B, F} Q: Finite set of states Σ: Language alphabet : tape alphabet (Σ ) : Transition function (Q x Σ Q x x {L,R}) q : Starting state B: The blank symbol F : Set of final states
37 Example a/x,r a/a,l Y/Y,L b/y,l q q q2 q3 q4 a/a,r
38 Example a/x,r a/a,l Y/Y,L b/y,l q q q2 q3 q4 a/a,r # # # # a a b b # # # # # # #
39 Example a/x,r a/a,l Y/Y,L b/y,l q q q2 q3 q4 a/a,r # # # # X a b b # # # # # # #
40 Example a/x,r a/a,l Y/Y,L b/y,l q q q2 q3 q4 a/a,r # # # # X a b b # # # # # # #
41 Example a/x,r a/a,l Y/Y,L b/y,l q q q2 q3 q4 a/a,r # # # # X a Y b # # # # # # #
42 Example a/x,r a/a,l Y/Y,L b/y,l q q q2 q3 q4 a/a,r # # # # X a Y b # # # # # # #
43 Example a/x,r a/a,l Y/Y,L b/y,l q q q2 q3 q4 a/a,r # # # # X a Y b # # # # # # #
44 Example a/x,r a/a,l Y/Y,L b/y,l q q q2 q3 q4 a/a,r # # # # X X Y b # # # # # # #
45 Example a/x,r a/a,l Y/Y,L b/y,l q q q2 q3 q4 a/a,r # # # # X X Y b # # # # # # #
46 Example a/x,r a/a,l Y/Y,L b/y,l q q q2 q3 q4 a/a,r # # # # X X Y Y # # # # # # #
47 Example a/x,r a/a,l Y/Y,L b/y,l q q q2 q3 q4 a/a,r # # # # X X Y Y # # # # # # #
48 Example a/x,r a/a,l Y/Y,L b/y,l q q q2 q3 q4 a/a,r # # # # X X Y Y # # # # # # #
49 Example a/x,r a/a,l Y/Y,L b/y,l q q q2 q3 q4 a/a,r # # # # X X Y Y # # # # # # #
50 Example a/x,r a/a,l Y/Y,L b/y,l q q q2 q3 q4 a/a,r # # # # X X Y Y # # # # # # #
51 Example a/x,r a/a,l Y/Y,L b/y,l q q q2 q3 q4 a/a,r # # # # X X Y Y # # # # # # #
52 What is the language this TM accepts? a/x,r b/y,l a/a,l Y/Y,L q q q2 q3 q4 a/a,r
53 Example -cont. (input 2) a/x,r a/a,l Y/Y,L b/y,l q q q2 q3 q4 a/a,r # # # # a b a b # # # # # # #
54 Example -cont. (input 2) a/x,r a/a,l Y/Y,L b/y,l q q q2 q3 q4 a/a,r # # # # X b a b # # # # # # #
55 Example -cont. (input 2) a/x,r a/a,l Y/Y,L b/y,l q q q2 q3 q4 a/a,r # # # # X Y a b # # # # # # #
56 Example -cont. (input 2) a/x,r a/a,l Y/Y,L b/y,l q q q2 q3 q4 a/a,r # # # # X Y a b # # # # # # #
57 Example -cont. (input 2) a/x,r a/a,l Y/Y,L b/y,l q q q2 q3 q4 a/a,r # # # # X Y a b # # # # # # #
58 a/x,r a/a,l Y/Y,L b/y,l q q q2 q3 q4 a/a,r Language: a n b n
59 Computing with Turing Machines Examples: A TM that accepts a number x divisible by 3 in unary format and outputs the results of the computation x/3 q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8
60 Divide by 3 TM q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8 # # # # # # # # # # #
61 Divide by 3 TM q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8 # # # # X # # # # # # #
62 Divide by 3 TM q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8 # # # # XX # # # # # # #
63 Divide by 3 TM q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8 # # # # XXX # # # # # # #
64 Divide by 3 TM q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8 # # # # XXX # # # # # # #
65 Divide by 3 TM q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8 # # # # XXX # # # # # # #
66 Divide by 3 TM q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8 # # # # XXX # # # # # # #
67 Divide by 3 TM q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8 # # # # XXX # # # # # # #
68 Divide by 3 TM q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8 # # # # XXX # # # # # #
69 Divide by 3 TM q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8 # # # # XXX # # # # # #
70 Divide by 3 TM q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8 # # # # XXX # # # # # #
71 Divide by 3 TM q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8 # # # # XXX # # # # # #
72 Divide by 3 TM q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8 # # # # XXX # # # # # #
73 Divide by 3 TM q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8 # # # # XXX # # # # # #
74 Divide by 3 TM q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8 # # # # XXXX # # # # # #
75 Divide by 3 TM q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8 # # # # XXXXX # # # # # #
76 Divide by 3 TM q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8 # # # # XXXXXX # # # # # #
77 Divide by 3 TM q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8 # # # # XXXXXX # # # # # #
78 Divide by 3 TM q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8 # # # # XXXXXX # # # # # #
79 Divide by 3 TM q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8 # # # # XXXXXX # # # # #
80 Divide by 3 TM q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8 # # # # XXXXXX # # # # #
81 Divide by 3 TM q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8 # # # # XXXXXX # # # # #
82 Divide by 3 TM q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8 # # # # XXXXXX # # # # #
83 Divide by 3 TM Try to parse q7 #/,L q q q2 q3 q4 q5 #/#,L q6 /,R /,R q8
84 More complex TM models Several tapes Several read/write heads A Turing machine can simulate a computer.
85 Back to Linear Bounded Automata state $ $ boundary boundary LBA is a TM whose read/write head never moves off the portion of the tape occupied by the input string
Multiple Choice Questions
Techno India Batanagar Computer Science and Engineering Model Questions Subject Name: Formal Language and Automata Theory Subject Code: CS 402 Multiple Choice Questions 1. The basic limitation of an FSM
More informationDecidable Problems. We examine the problems for which there is an algorithm.
Decidable Problems We examine the problems for which there is an algorithm. Decidable Problems A problem asks a yes/no question about some input. The problem is decidable if there is a program that always
More informationCT32 COMPUTER NETWORKS DEC 2015
Q.2 a. Using the principle of mathematical induction, prove that (10 (2n-1) +1) is divisible by 11 for all n N (8) Let P(n): (10 (2n-1) +1) is divisible by 11 For n = 1, the given expression becomes (10
More informationJNTUWORLD. Code No: R
Code No: R09220504 R09 SET-1 B.Tech II Year - II Semester Examinations, April-May, 2012 FORMAL LANGUAGES AND AUTOMATA THEORY (Computer Science and Engineering) Time: 3 hours Max. Marks: 75 Answer any five
More informationSkyup's Media. PART-B 2) Construct a Mealy machine which is equivalent to the Moore machine given in table.
Code No: XXXXX JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY, HYDERABAD B.Tech II Year I Semester Examinations (Common to CSE and IT) Note: This question paper contains two parts A and B. Part A is compulsory
More information(a) R=01[((10)*+111)*+0]*1 (b) ((01+10)*00)*. [8+8] 4. (a) Find the left most and right most derivations for the word abba in the grammar
Code No: R05310501 Set No. 1 III B.Tech I Semester Regular Examinations, November 2008 FORMAL LANGUAGES AND AUTOMATA THEORY (Computer Science & Engineering) Time: 3 hours Max Marks: 80 Answer any FIVE
More informationLanguages and Compilers
Principles of Software Engineering and Operational Systems Languages and Compilers SDAGE: Level I 2012-13 3. Formal Languages, Grammars and Automata Dr Valery Adzhiev vadzhiev@bournemouth.ac.uk Office:
More informationQUESTION BANK. Formal Languages and Automata Theory(10CS56)
QUESTION BANK Formal Languages and Automata Theory(10CS56) Chapter 1 1. Define the following terms & explain with examples. i) Grammar ii) Language 2. Mention the difference between DFA, NFA and εnfa.
More informationFormal languages and computation models
Formal languages and computation models Guy Perrier Bibliography John E. Hopcroft, Rajeev Motwani, Jeffrey D. Ullman - Introduction to Automata Theory, Languages, and Computation - Addison Wesley, 2006.
More informationVALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur 603203. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Year & Semester : III Year, V Semester Section : CSE - 1 & 2 Subject Code : CS6503 Subject
More informationUNIT I PART A PART B
OXFORD ENGINEERING COLLEGE (NAAC ACCREDITED WITH B GRADE) DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING LIST OF QUESTIONS YEAR/SEM: III/V STAFF NAME: Dr. Sangeetha Senthilkumar SUB.CODE: CS6503 SUB.NAME:
More informationT.E. (Computer Engineering) (Semester I) Examination, 2013 THEORY OF COMPUTATION (2008 Course)
*4459255* [4459] 255 Seat No. T.E. (Computer Engineering) (Semester I) Examination, 2013 THEY OF COMPUTATION (2008 Course) Time : 3 Hours Max. Marks : 100 Instructions : 1) Answers to the two Sections
More informationDecision Properties for Context-free Languages
Previously: Decision Properties for Context-free Languages CMPU 240 Language Theory and Computation Fall 2018 Context-free languages Pumping Lemma for CFLs Closure properties for CFLs Today: Assignment
More informationR10 SET a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA?
R1 SET - 1 1. a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA? 2. a) Design a DFA that accepts the language over = {, 1} of all strings that
More informationCS 44 Exam #2 February 14, 2001
CS 44 Exam #2 February 14, 2001 Name Time Started: Time Finished: Each question is equally weighted. You may omit two questions, but you must answer #8, and you can only omit one of #6 or #7. Circle the
More informationQUESTION BANK. Unit 1. Introduction to Finite Automata
QUESTION BANK Unit 1 Introduction to Finite Automata 1. Obtain DFAs to accept strings of a s and b s having exactly one a.(5m )(Jun-Jul 10) 2. Obtain a DFA to accept strings of a s and b s having even
More informationKEY. A 1. The action of a grammar when a derivation can be found for a sentence. Y 2. program written in a High Level Language
1 KEY CS 441G Fall 2018 Exam 1 Matching: match the best term from the following list to its definition by writing the LETTER of the term in the blank to the left of the definition. (1 point each) A Accepts
More informationFinite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016
Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016 Lecture 15 Ana Bove May 23rd 2016 More on Turing machines; Summary of the course. Overview of today s lecture: Recap: PDA, TM Push-down
More informationClosure Properties of CFLs; Introducing TMs. CS154 Chris Pollett Apr 9, 2007.
Closure Properties of CFLs; Introducing TMs CS154 Chris Pollett Apr 9, 2007. Outline Closure Properties of Context Free Languages Algorithms for CFLs Introducing Turing Machines Closure Properties of CFL
More informationPDA s. and Formal Languages. Automata Theory CS 573. Outline of equivalence of PDA s and CFG s. (see Theorem 5.3)
CS 573 Automata Theory and Formal Languages Professor Leslie Lander Lecture # 20 November 13, 2000 Greibach Normal Form (GNF) Sheila Greibach s normal form (GNF) for a CFG is one where EVERY production
More informationCS 441G Fall 2018 Exam 1 Matching: LETTER
CS 441G Fall 2018 Exam 1 Matching: match the best term from the following list to its definition by writing the LETTER of the term in the blank to the left of the definition. All 31 definitions are given
More informationFormal Languages and Automata
Mobile Computing and Software Engineering p. 1/3 Formal Languages and Automata Chapter 3 Regular languages and Regular Grammars Chuan-Ming Liu cmliu@csie.ntut.edu.tw Department of Computer Science and
More informationCS402 - Theory of Automata FAQs By
CS402 - Theory of Automata FAQs By Define the main formula of Regular expressions? Define the back ground of regular expression? Regular expressions are a notation that you can think of similar to a programming
More informationTheory of Programming Languages COMP360
Theory of Programming Languages COMP360 Sometimes it is the people no one imagines anything of, who do the things that no one can imagine Alan Turing What can be computed? Before people even built computers,
More informationDerivations of a CFG. MACM 300 Formal Languages and Automata. Context-free Grammars. Derivations and parse trees
Derivations of a CFG MACM 300 Formal Languages and Automata Anoop Sarkar http://www.cs.sfu.ca/~anoop strings grow on trees strings grow on Noun strings grow Object strings Verb Object Noun Verb Object
More informationCSC-461 Exam #2 April 16, 2014
Pledge: On my honor, I pledge that I have not discussed any of the questions on this exam with fellow students, nor will I until after 7 p.m. tonight. Signed: CSC-461 Exam #2 April 16, 2014 Name Time Started:
More informationFinite Automata. Dr. Nadeem Akhtar. Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur
Finite Automata Dr. Nadeem Akhtar Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur PhD Laboratory IRISA-UBS University of South Brittany European University
More information1 Parsing (25 pts, 5 each)
CSC173 FLAT 2014 ANSWERS AND FFQ 30 September 2014 Please write your name on the bluebook. You may use two sides of handwritten notes. Perfect score is 75 points out of 85 possible. Stay cool and please
More informationUniversal Turing Machine Chomsky Hierarchy Decidability Reducibility Uncomputable Functions Rice s Theorem Decidability Continued
CD5080 AUBER odels of Computation, anguages and Automata ecture 14 älardalen University Content Universal Turing achine Chomsky Hierarchy Decidability Reducibility Uncomputable Functions Rice s Decidability
More informationAUTOMATA THEORY AND COMPUTABILITY
AUTOMATA THEORY AND COMPUTABILITY QUESTION BANK Module 1 : Introduction to theory of computation and FSM Objective: Upon the completion of this chapter you will be able to Define Finite automata, Basic
More informationStructure of a Compiler: Scanner reads a source, character by character, extracting lexemes that are then represented by tokens.
CS 441 Fall 2018 Notes Compiler - software that translates a program written in a source file into a program stored in a target file, reporting errors when found. Source Target program written in a High
More informationMIT Specifying Languages with Regular Expressions and Context-Free Grammars. Martin Rinard Massachusetts Institute of Technology
MIT 6.035 Specifying Languages with Regular essions and Context-Free Grammars Martin Rinard Massachusetts Institute of Technology Language Definition Problem How to precisely define language Layered structure
More informationMIT Specifying Languages with Regular Expressions and Context-Free Grammars
MIT 6.035 Specifying Languages with Regular essions and Context-Free Grammars Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology Language Definition Problem How to precisely
More informationTAFL 1 (ECS-403) Unit- V. 5.1 Turing Machine. 5.2 TM as computer of Integer Function
TAFL 1 (ECS-403) Unit- V 5.1 Turing Machine 5.2 TM as computer of Integer Function 5.2.1 Simulating Turing Machine by Computer 5.2.2 Simulating Computer by Turing Machine 5.3 Universal Turing Machine 5.4
More informationKHALID PERVEZ (MBA+MCS) CHICHAWATNI
FAQ's about Lectures 1 to 5 QNo1.What is the difference between the strings and the words of a language? A string is any combination of the letters of an alphabet where as the words of a language are the
More informationCS402 - Theory of Automata Glossary By
CS402 - Theory of Automata Glossary By Acyclic Graph : A directed graph is said to be acyclic if it contains no cycles. Algorithm : A detailed and unambiguous sequence of instructions that describes how
More informationCS5371 Theory of Computation. Lecture 8: Automata Theory VI (PDA, PDA = CFG)
CS5371 Theory of Computation Lecture 8: Automata Theory VI (PDA, PDA = CFG) Objectives Introduce Pushdown Automaton (PDA) Show that PDA = CFG In terms of descriptive power Pushdown Automaton (PDA) Roughly
More informationModels of Computation II: Grammars and Pushdown Automata
Models of Computation II: Grammars and Pushdown Automata COMP1600 / COMP6260 Dirk Pattinson Australian National University Semester 2, 2018 Catch Up / Drop in Lab Session 1 Monday 1100-1200 at Room 2.41
More informationActually talking about Turing machines this time
Actually talking about Turing machines this time 10/25/17 (Using slides adapted from the book) Administrivia HW due now (Pumping lemma for context-free languages) HW due Friday (Building TMs) Exam 2 out
More informationFinal Course Review. Reading: Chapters 1-9
Final Course Review Reading: Chapters 1-9 1 Objectives Introduce concepts in automata theory and theory of computation Identify different formal language classes and their relationships Design grammars
More informationAutomata Theory CS S-FR Final Review
Automata Theory CS411-2015S-FR Final Review David Galles Department of Computer Science University of San Francisco FR-0: Sets & Functions Sets Membership: a?{a,b,c} a?{b,c} a?{b,{a,b,c},d} {a,b,c}?{b,{a,b,c},d}
More informationCS6160 Theory of Computation Problem Set 2 Department of Computer Science, University of Virginia
CS6160 Theory of Computation Problem Set 2 Department of Computer Science, University of Virginia Gabriel Robins Please start solving these problems immediately, and work in study groups. Please prove
More informationCS 314 Principles of Programming Languages. Lecture 3
CS 314 Principles of Programming Languages Lecture 3 Zheng Zhang Department of Computer Science Rutgers University Wednesday 14 th September, 2016 Zheng Zhang 1 CS@Rutgers University Class Information
More informationThe Turing Machine. Unsolvable Problems. Undecidability. The Church-Turing Thesis (1936) Decision Problem. Decision Problems
The Turing Machine Unsolvable Problems Motivating idea Build a theoretical a human computer Likened to a human with a paper and pencil that can solve problems in an algorithmic way The theoretical machine
More informationCS402 Theory of Automata Solved Subjective From Midterm Papers. MIDTERM SPRING 2012 CS402 Theory of Automata
Solved Subjective From Midterm Papers Dec 07,2012 MC100401285 Moaaz.pk@gmail.com Mc100401285@gmail.com PSMD01 MIDTERM SPRING 2012 Q. Point of Kleen Theory. Answer:- (Page 25) 1. If a language can be accepted
More information2. Lexical Analysis! Prof. O. Nierstrasz!
2. Lexical Analysis! Prof. O. Nierstrasz! Thanks to Jens Palsberg and Tony Hosking for their kind permission to reuse and adapt the CS132 and CS502 lecture notes.! http://www.cs.ucla.edu/~palsberg/! http://www.cs.purdue.edu/homes/hosking/!
More informationLimits of Computation p.1/?? Limits of Computation p.2/??
Context-Free Grammars (CFG) There are languages, such as {0 n 1 n n 0} that cannot be described (specified) by finite automata or regular expressions. Context-free grammars provide a more powerful mechanism
More informationTuring Machine Languages
Turing Machine Languages Based on Chapters 23-24-25 of (Cohen 1997) Introduction A language L over alphabet is called recursively enumerable (r.e.) if there is a Turing Machine T that accepts every word
More informationCS 314 Principles of Programming Languages
CS 314 Principles of Programming Languages Lecture 2: Syntax Analysis Zheng (Eddy) Zhang Rutgers University January 22, 2018 Announcement First recitation starts this Wednesday Homework 1 will be release
More informationHomework & Announcements
Homework & nnouncements New schedule on line. Reading: Chapter 18 Homework: Exercises at end Due: 11/1 Copyright c 2002 2017 UMaine School of Computing and Information S 1 / 25 COS 140: Foundations of
More informationTuring Machines. A transducer is a finite state machine (FST) whose output is a string and not just accept or reject.
Turing Machines Transducers: A transducer is a finite state machine (FST) whose output is a string and not just accept or reject. Each transition of an FST is labeled with two symbols, one designating
More informationIntroduction to Syntax Analysis
Compiler Design 1 Introduction to Syntax Analysis Compiler Design 2 Syntax Analysis The syntactic or the structural correctness of a program is checked during the syntax analysis phase of compilation.
More informationFinite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018
Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Lecture 11 Ana Bove April 26th 2018 Recap: Regular Languages Decision properties of RL: Is it empty? Does it contain this word? Contains
More informationTheory of Computations Spring 2016 Practice Final Exam Solutions
1 of 8 Theory of Computations Spring 2016 Practice Final Exam Solutions Name: Directions: Answer the questions as well as you can. Partial credit will be given, so show your work where appropriate. Try
More informationONE-STACK AUTOMATA AS ACCEPTORS OF CONTEXT-FREE LANGUAGES *
ONE-STACK AUTOMATA AS ACCEPTORS OF CONTEXT-FREE LANGUAGES * Pradip Peter Dey, Mohammad Amin, Bhaskar Raj Sinha and Alireza Farahani National University 3678 Aero Court San Diego, CA 92123 {pdey, mamin,
More information3. Syntax Analysis. Andrea Polini. Formal Languages and Compilers Master in Computer Science University of Camerino
3. Syntax Analysis Andrea Polini Formal Languages and Compilers Master in Computer Science University of Camerino (Formal Languages and Compilers) 3. Syntax Analysis CS@UNICAM 1 / 54 Syntax Analysis: the
More informationWeek 2: Syntax Specification, Grammars
CS320 Principles of Programming Languages Week 2: Syntax Specification, Grammars Jingke Li Portland State University Fall 2017 PSU CS320 Fall 17 Week 2: Syntax Specification, Grammars 1/ 62 Words and Sentences
More informationContext-Free Grammars
Context-Free Grammars 1 Informal Comments A context-free grammar is a notation for describing languages. It is more powerful than finite automata or RE s, but still cannot define all possible languages.
More informationECS 120 Lesson 16 Turing Machines, Pt. 2
ECS 120 Lesson 16 Turing Machines, Pt. 2 Oliver Kreylos Friday, May 4th, 2001 In the last lesson, we looked at Turing Machines, their differences to finite state machines and pushdown automata, and their
More informationA Characterization of the Chomsky Hierarchy by String Turing Machines
A Characterization of the Chomsky Hierarchy by String Turing Machines Hans W. Lang University of Applied Sciences, Flensburg, Germany Abstract A string Turing machine is a variant of a Turing machine designed
More informationIntroduction to Syntax Analysis. The Second Phase of Front-End
Compiler Design IIIT Kalyani, WB 1 Introduction to Syntax Analysis The Second Phase of Front-End Compiler Design IIIT Kalyani, WB 2 Syntax Analysis The syntactic or the structural correctness of a program
More informationAUBER (Models of Computation, Languages and Automata) EXERCISES
AUBER (Models of Computation, Languages and Automata) EXERCISES Xavier Vera, 2002 Languages and alphabets 1.1 Let be an alphabet, and λ the empty string over. (i) Is λ in? (ii) Is it true that λλλ=λ? Is
More informationContext Free Languages and Pushdown Automata
Context Free Languages and Pushdown Automata COMP2600 Formal Methods for Software Engineering Ranald Clouston Australian National University Semester 2, 2013 COMP 2600 Context Free Languages and Pushdown
More informationEquivalence of NTMs and TMs
Equivalence of NTMs and TMs What is a Turing Machine? Similar to a finite automaton, but with unlimited and unrestricted memory. It uses an infinitely long tape as its memory which can be read from and
More informationRegular Expressions & Automata
Regular Expressions & Automata CMSC 132 Department of Computer Science University of Maryland, College Park Regular expressions Notation Patterns Java support Automata Languages Finite State Machines Turing
More informationCompiler Design. 2. Regular Expressions & Finite State Automata (FSA) Kanat Bolazar January 21, 2010
Compiler Design. Regular Expressions & Finite State Automata (FSA) Kanat Bolazar January 1, 010 Contents In these slides we will see 1.Introduction, Concepts and Notations.Regular Expressions, Regular
More informationCS/B.Tech/CSE/IT/EVEN/SEM-4/CS-402/ ItIauIafIaAblll~AladUnrtel1ity
CS/B.Tech/CSE/IT/EVEN/SEM-4/CS-402/2015-16 ItIauIafIaAblll~AladUnrtel1ity ~ t; ~~ ) MAULANA ABUL KALAM AZAD UNIVERSITY OF TECHNOLOGY, WEST BENGAL Paper Code: CS-402 FORMAL LANGUAGE AND AUTOMATA THEORY
More informationLecture 4: Syntax Specification
The University of North Carolina at Chapel Hill Spring 2002 Lecture 4: Syntax Specification Jan 16 1 Phases of Compilation 2 1 Syntax Analysis Syntax: Webster s definition: 1 a : the way in which linguistic
More informationWe can create PDAs with multiple stacks. At each step we look at the current state, the current input symbol, and the top of each stack.
Other Automata We can create PDAs with multiple stacks. At each step we look at the current state, the current input symbol, and the top of each stack. From all of this information we decide what state
More informationAn Interactive Approach to Formal Languages and Automata with JFLAP
An Interactive Approach to Formal Languages and Automata with JFLAP Susan H. Rodger Duke University NSF CCLI Showcase March 9, 2007 Supported by NSF Grant DUE 0442513. Outline Overview of JFLAP Examples
More informationFormal Languages and Grammars. Chapter 2: Sections 2.1 and 2.2
Formal Languages and Grammars Chapter 2: Sections 2.1 and 2.2 Formal Languages Basis for the design and implementation of programming languages Alphabet: finite set Σ of symbols String: finite sequence
More informationLecture 8: Context Free Grammars
Lecture 8: Context Free s Dr Kieran T. Herley Department of Computer Science University College Cork 2017-2018 KH (12/10/17) Lecture 8: Context Free s 2017-2018 1 / 1 Specifying Non-Regular Languages Recall
More informationChapter 14: Pushdown Automata
Chapter 14: Pushdown Automata Peter Cappello Department of Computer Science University of California, Santa Barbara Santa Barbara, CA 93106 cappello@cs.ucsb.edu The corresponding textbook chapter should
More informationSyntax Analysis Part I
Syntax Analysis Part I Chapter 4: Context-Free Grammars Slides adapted from : Robert van Engelen, Florida State University Position of a Parser in the Compiler Model Source Program Lexical Analyzer Token,
More informationPS3 - Comments. Describe precisely the language accepted by this nondeterministic PDA.
University of Virginia - cs3102: Theory of Computation Spring 2010 PS3 - Comments Average: 46.6 (full credit for each question is 55 points) Problem 1: Mystery Language. (Average 8.5 / 10) In Class 7,
More informationNon-deterministic Finite Automata (NFA)
Non-deterministic Finite Automata (NFA) CAN have transitions on the same input to different states Can include a ε or λ transition (i.e. move to new state without reading input) Often easier to design
More informationwhere is the transition function, Pushdown Automata is the set of accept states. is the start state, and is the set of states, is the input alphabet,
!# #! + Pushdown utomata CS5 ecture Pushdown utomata where pushdown automaton is a 6tuple are finite sets is the set of states is the input alphabet is the stack alphabet is the transition function is
More information1. Which of the following regular expressions over {0, 1} denotes the set of all strings not containing 100 as a sub-string?
Multiple choice type questions. Which of the following regular expressions over {, } denotes the set of all strings not containing as a sub-string? 2. DFA has a) *(*)* b) ** c) ** d) *(+)* a) single final
More informationCISC 4090 Theory of Computation
CISC 4090 Theory of Computation Turing machines Professor Daniel Leeds dleeds@fordham.edu JMH 332 Alan Turing (1912-1954) Father of Theoretical Computer Science Key figure in Artificial Intelligence Codebreaker
More informationSpecifying Syntax COMP360
Specifying Syntax COMP360 The most important thing in the programming language is the name. A language will not succeed without a good name. I have recently invented a very good name and now I am looking
More informationCompiler Construction
Compiler Construction Exercises 1 Review of some Topics in Formal Languages 1. (a) Prove that two words x, y commute (i.e., satisfy xy = yx) if and only if there exists a word w such that x = w m, y =
More informationCompilation 2012 Context-Free Languages Parsers and Scanners. Jan Midtgaard Michael I. Schwartzbach Aarhus University
Compilation 2012 Parsers and Scanners Jan Midtgaard Michael I. Schwartzbach Aarhus University Context-Free Grammars Example: sentence subject verb object subject person person John Joe Zacharias verb asked
More informationCS210 THEORY OF COMPUTATION QUESTION BANK PART -A UNIT- I
CS210 THEORY OF COMPUTATION QUESTION BANK PART -A UNIT- I 1) Is it true that the language accepted by any NDFA is different from the regular language? Justify your answer. 2) Describe the following sets
More informationIntroduction to Computers & Programming
16.070 Introduction to Computers & Programming Theory of computation 5: Reducibility, Turing machines Prof. Kristina Lundqvist Dept. of Aero/Astro, MIT States and transition function State control A finite
More informationNotes for Comp 454 Week 2
Notes for Comp 454 Week 2 This week we look at the material in chapters 3 and 4. Homework on Chapters 2, 3 and 4 is assigned (see end of notes). Answers to the homework problems are due by September 10th.
More informationChapter 4: Regular Expressions
CSI 3104 /Winter 2011: Introduction to Formal Languages What are the languages with a finite representation? We start with a simple and interesting class of such languages. Dr. Nejib Zaguia CSI3104-W11
More informationAbout the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design
i About the Tutorial A compiler translates the codes written in one language to some other language without changing the meaning of the program. It is also expected that a compiler should make the target
More information1. (a) What are the closure properties of Regular sets? Explain. (b) Briefly explain the logical phases of a compiler model. [8+8]
Code No: R05311201 Set No. 1 1. (a) What are the closure properties of Regular sets? Explain. (b) Briefly explain the logical phases of a compiler model. [8+8] 2. Compute the FIRST and FOLLOW sets of each
More informationCSCI312 Principles of Programming Languages!
CSCI312 Principles of Programming Languages!! Chapter 3 Regular Expression and Lexer Xu Liu Recap! Copyright 2006 The McGraw-Hill Companies, Inc. Clite: Lexical Syntax! Input: a stream of characters from
More informationLexical Analysis. Prof. James L. Frankel Harvard University
Lexical Analysis Prof. James L. Frankel Harvard University Version of 5:37 PM 30-Jan-2018 Copyright 2018, 2016, 2015 James L. Frankel. All rights reserved. Regular Expression Notation We will develop a
More informationDHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY SIRUVACHUR, PERAMBALUR DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY SIRUVACHUR, PERAMBALUR-621113 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Third Year CSE( Sem:V) CS2303- THEORY OF COMPUTATION PART B-16
More informationCMSC 132: Object-Oriented Programming II
CMSC 132: Object-Oriented Programming II Regular Expressions & Automata Department of Computer Science University of Maryland, College Park 1 Regular expressions Notation Patterns Java support Automata
More informationTheory Bridge Exam Example Questions Version of June 6, 2008
Theory Bridge Exam Example Questions Version of June 6, 2008 This is a collection of sample theory bridge exam questions. This is just to get some idea of the format of the bridge exam and the level of
More informationLast lecture CMSC330. This lecture. Finite Automata: States. Finite Automata. Implementing Regular Expressions. Languages. Regular expressions
Last lecture CMSC330 Finite Automata Languages Sets of strings Operations on languages Regular expressions Constants Operators Precedence 1 2 Finite automata States Transitions Examples Types This lecture
More informationLexical Analysis. Chapter 2
Lexical Analysis Chapter 2 1 Outline Informal sketch of lexical analysis Identifies tokens in input string Issues in lexical analysis Lookahead Ambiguities Specifying lexers Regular expressions Examples
More informationFrom Theorem 8.5, page 223, we have that the intersection of a context-free language with a regular language is context-free. Therefore, the language
CSCI 2400 Models of Computation, Section 3 Solutions to Practice Final Exam Here are solutions to the practice final exam. For some problems some details are missing for brevity. You should write complete
More informationDefinition 2.8: A CFG is in Chomsky normal form if every rule. only appear on the left-hand side, we allow the rule S ǫ.
CS533 Class 02b: 1 c P. Heeman, 2017 CNF Pushdown Automata Definition Equivalence Overview CS533 Class 02b: 2 c P. Heeman, 2017 Chomsky Normal Form Definition 2.8: A CFG is in Chomsky normal form if every
More information1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which:
P R O B L E M S Finite Autom ata. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which: a) Are a multiple of three in length. b) End with the string
More informationHomework. Announcements. Before We Start. Languages. Plan for today. Chomsky Normal Form. Final Exam Dates have been announced
Homework Homework #3 returned Homework #4 due today Homework #5 Pg 169 -- Exercise 4 Pg 183 -- Exercise 4c,e,i Pg 184 -- Exercise 10 Pg 184 -- Exercise 12 Pg 185 -- Exercise 17 Due 10 / 17 Announcements
More informationCSCI 340: Computational Models. Turing Machines. Department of Computer Science
CSCI 340: Computational Models Turing Machines Chapter 19 Department of Computer Science The Turing Machine Regular Expressions Acceptor: FA, TG Nondeterminism equal? Yes Closed Under: L 1 + L 2 L 1 L
More information