Semantic Analysis. CSCI 3136 Principles of Programming Languages. Faculty of Computer Science Dalhousie University. Winter Reading: Chapter 4
|
|
- Eleanore Barker
- 6 years ago
- Views:
Transcription
1 Semnti nlysis SI 16 Priniples of Progrmming Lnguges Fulty of omputer Siene Dlhousie University Winter 2012 Reding: hpter 4
2 Motivtion Soure progrm (hrter strem) Snner (lexil nlysis) Front end Prse tree Prser (syntti nlysis) Token strem k end Modified intermedite form Modified trget lnguge Semnti nlysis nd ode genertion Mhine-independent ode improvement Trget ode genertion Mhine-speifi ode improvement strt syntx tree or other intermedite form Trget lnguge (e.g., ssemly) Symol tle Semnti nlysis
3 Syntx nd Semntis Syntx Desries form of vlid progrm n e desried y ontext-free grmmr Semntis Desries mening of progrm nnot e e desried y ontext-free grmmr Some onstrints tht my pper syntti re enfored y semnti nlysis: E.g., use of identifier only fter its delrtion Semnti nlysis
4 Semnti nlysis Enfores semnti rules uilds intermedite representtion (e.g., strt syntx tree) Fills symol tle Psses results to intermedite ode genertor Two pprohes Interleved with syntti nlysis s seprte phse Forml mehnism: ttriutes grmmrs Semnti nlysis
5 Enforing Semnti Rules Stti semnti rules Enfored y ompiler t ompile time Exmple: Do not use undelred vrile Dynmi semnti rules ompiler genertes ode for enforement t run time Exmples: division y zero, rry index out of ounds Some ompilers llow these heks to e disled Semnti nlysis
6 ttriute Grmmrs n ttriute grmmr is n ugmented ontext-free grmmr: Eh symol in prodution hs numer of ttriutes. Eh prodution is ugmented with semnti rules tht opy ttriute vlues etween symols, Evlute ttriute vlues using semnti funtions, Enfore onstrints on ttriute vlues. Semnti nlysis
7 ttriute Grmmrs: Exmple E E + T E E - T E T T T * F T T / F T F F -F F ( E ) F onst Semnti nlysis
8 ttriute Grmmrs: Exmple E E + T E E - T E T T T * F T T / F T F F -F F ( E ) E 1 E 2 + T E 1 E 2 - T E T T 1 T 2 * F T 1 T 2 / F T F F 1 -F 2 F ( E ) F onst F onst E 1.vl := sum(e 2.vl, T.vl) E 1.vl := differene(e 2.vl, T.vl) E.vl := T.vl T 1.vl := produt(t 2.vl, F.vl) T 1.vl := quotient(t 2.vl, F.vl) T.vl := F.vl F 1.vl := negte(f 2.vl) F.vl := E.vl F.vl := onst.vl Semnti nlysis
9 Synthesized ttriutes (ottom-up) The lnguge { n n n n 1} = {,,,... } is not ontext-free ut n e reognized y n ttriute grmmr. Synthesized ttriutes: ttriutes of LHS re omputed from ttriutes of RHS. S ondition:.ount =.ount =.ount.ount := ount := 2.ount + 1.ount := ount := 2.ount + 1.ount := ount := 2.ount + 1 Semnti nlysis
10 Synthesized ttriutes: Prse Tree Deortion (1) Input: Prse tree S Semnti nlysis
11 Synthesized ttriutes: Prse Tree Deortion (1) Input: Prse tree S = = Semnti nlysis
12 Synthesized ttriutes: Prse Tree Deortion (2) Input: Prse tree S Semnti nlysis
13 Synthesized ttriutes: Prse Tree Deortion (2) Input: Prse tree S Semnti nlysis
14 Inherited ttriutes (Top-Down) Inherited ttriutes: ttriutes flow from left to right (from LHS to RHS nd from symols of RHS to symols of RHS further to the right). S.inhount :=.ount;.inhount :=.ount.ount := ount := 2.ount + 1 ondition:.inhount = inhount := 1.inhount 1 ondition:.inhount := inhount := 1.inhount 1 Semnti nlysis
15 Inherited ttriutes: Prse Tree Deortion (1) Input: Prse tree S Semnti nlysis
16 Inherited ttriutes: Prse Tree Deortion (1) Input: Prse tree S = 1 1 = 1 Semnti nlysis
17 Inherited ttriutes: Prse Tree Deortion (2) Input: Prse tree S Semnti nlysis
18 Inherited ttriutes: Prse Tree Deortion (2) Input: Prse tree S = 1 Semnti nlysis
19 ttriute Flow nnottion or deortion of prse tree Proess of evluting ttriutes Synthesized ttriutes ttriutes of LHS of prodution re omputed from ttriutes of the symols in its RHS. ttriutes flow ottom-up in the prse tree. Inherited ttriutes ttriutes for symols in RHS re omputed from ttriutes of LHS nd symols in RHS preeding them. ttriutes flow top-down in the prse tree. Semnti nlysis
20 S-ttriuted nd L-ttriuted Grmmrs S-ttriuted grmmr ll ttriutes re synthesized. ttriutes flow ottom-up. L-ttriuted grmmr For eh prodution X Y 1 Y 2... Y k, X.syn depends on X.inh nd Y 1.inh, Y 1.syn, Y 2.inh, Y 2.syn,..., Y k.inh, Y k.syn. For ll 1 i k, Y i.inh depends on X.inh nd Y 1.inh, Y 1.syn, Y 2.inh, Y 2.syn,..., Y i 1.inh, Y i 1.syn. S-ttriuted grmmrs re speil se of L-ttriuted grmmrs. Semnti nlysis
21 LL(1) Prsing, Left-ssoitivity, nd L-ttriuted Grmmrs simple grmmr for rithmeti expressions using only ddition nd sutrtion = (10 ) + 5 = ( + 5) = 2 Semnti nlysis
22 LL(1) Prsing, Left-ssoitivity, nd L-ttriuted Grmmrs simple grmmr for rithmeti expressions using only ddition nd sutrtion E T E ET = (10 ) + 5 = ( + 5) = 2 T n + - E E T E T + 5 T - 10 Semnti nlysis
23 LL(1) Prsing, Left-ssoitivity, nd L-ttriuted Grmmrs simple grmmr for rithmeti expressions using only ddition nd sutrtion E T E ET = (10 ) + 5 = ( + 5) = 2 T n + - E E T E T + 5 T - 10 This grmmr ptures left-ssoitivity. Semnti nlysis
24 LL(1) Prsing, Left-ssoitivity, nd L-ttriuted Grmmrs simple grmmr for rithmeti expressions using only ddition nd sutrtion E T E ET = (10 ) + 5 = ( + 5) = 2 T n + - E 7 E 12 dd T 5 E 10 su T T This grmmr ptures left-ssoitivity. Semnti nlysis
25 LL(1) Prsing, Left-ssoitivity, nd L-ttriuted Grmmrs simple grmmr for rithmeti expressions using only ddition nd sutrtion E T E ET = (10 ) + 5 = ( + 5) = 2 T n + - E 7 E 12 dd T 5 Rule R PREDIT(R) E T su T E T E ET T n + - {n} {n} {n} {+} {-} This grmmr ptures left-ssoitivity. It is not LL(1). Semnti nlysis
26 LL(1) Prsing, Left-ssoitivity, nd L-ttriuted Grmmrs n LL(1) grmmr for the sme lnguge E T E $ E ɛ E 1 T E 2 T n + - Rule R E T E $ {n} E 2.op :=.fun(e E 1.op, T.vl); ɛ E 1.vl {$} := E 2.vl E T E {+,-} T n + - PREDIT(R) {n} {+} {-} Semnti nlysis
27 LL(1) Prsing, Left-ssoitivity, nd L-ttriuted Grmmrs n LL(1) grmmr for the sme lnguge E T E $ E ɛ E 1 T E 2 T n + - Rule R E T E $ {n} E 2.op :=.fun(e E 1.op, T.vl); ɛ E 1.vl {$} := E 2.vl E T E {+,-} T n + - PREDIT(R) {n} {+} {-} E T E $ 10 T E - T E + 5 ɛ Semnti nlysis
28 LL(1) Prsing, Left-ssoitivity, nd L-ttriuted Grmmrs n LL(1) grmmr for the sme lnguge E T E $ E ɛ E 1 T E 2 T n + - E.op := T.vl; E.vl := E.vl E.vl := E.op E 2.op :=.fun(e 1.op, T.vl); E 1.vl := E 2.vl T.vl := n.vl.fun := dd.fun := su E T E $ su T 7 E 12 - dd T 5 12 E ɛ Semnti nlysis
29 tion Routines tion routines re instrutions for d-ho trnsltion interleved with prsing. Prser genertors llow progrmmers to speify tion routines in the grmmr. tion routines n pper nywhere in rule (s long s the grmmr is LL(1)). Exmple E 1 T { E 2.op =.fun(e 1.op, T.vl) } E 2 { E 1.vl = E 2.vl } tion routines re supported, for exmple, in y nd ison. Semnti nlysis
SEMANTIC ANALYSIS PRINCIPLES OF PROGRAMMING LANGUAGES. Norbert Zeh Winter Dalhousie University 1/28
SEMNTI NLYSIS PRINIPLES OF PROGRMMING LNGUGES Norbert Zeh Winter 2018 Dlhousie University 1/28 PROGRM TRNSLTION FLOW HRT Soure progrm (hrter strem) Snner (lexil nlysis) Front end Prse tree Prser (syntti
More informationCS 314 Principles of Programming Languages
C 314 Principles of Progrmming Lnguges Lecture 6: LL(1) Prsing Zheng (Eddy) Zhng Rutgers University Ferury 5, 2018 Clss Informtion Homework 2 due tomorrow. Homework 3 will e posted erly next week. 2 Top
More informationCS241 Week 6 Tutorial Solutions
241 Week 6 Tutoril olutions Lnguges: nning & ontext-free Grmmrs Winter 2018 1 nning Exerises 1. 0x0x0xd HEXINT 0x0 I x0xd 2. 0xend--- HEXINT 0xe I nd ER -- MINU - 3. 1234-120x INT 1234 INT -120 I x 4.
More informationCS311 Computational Structures Regular Languages and Regular Grammars. Lecture 6
CS311 Computtionl Strutures Regulr Lnguges nd Regulr Grmmrs Leture 6 1 Wht we know so fr: RLs re losed under produt, union nd * Every RL n e written s RE, nd every RE represents RL Every RL n e reognized
More informationFABER Formal Languages, Automata and Models of Computation
DVA337 FABER Forml Lnguges, Automt nd Models of Computtion Lecture 5 chool of Innovtion, Design nd Engineering Mälrdlen University 2015 1 Recp of lecture 4 y definition suset construction DFA NFA stte
More informationOverview HC9. Parsing: Top-Down & LL(1) Context-Free Grammars (1) Introduction. CFGs (3) Context-Free Grammars (2) Vertalerbouw HC 9: Ch.
Overview H9 Vertlerouw H 9: Prsing: op-down & LL(1) do 3 mei 2001 56 heo Ruys h. 8 - Prsing 8.1 ontext-free Grmmrs 8.2 op-down Prsing 8.3 LL(1) Grmmrs See lso [ho, Sethi & Ullmn 1986] for more thorough
More informationBottom-Up Parsing. Canonical Collection of LR(0) items. Part II
2 ottom-up Prsing Prt II 1 Cnonil Colletion of LR(0) items CC_LR(0)_I items(g :ugmented_grmmr){ C = {CLOURE({ })} ; repet{ foreh(i C) foreh(grmmr symol X) if(goto(i,x) && GOTO(I,X) C) C = C {GOTO(I,X)};
More informationThe University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER MACHINES AND THEIR LANGUAGES ANSWERS
The University of ottinghm SCHOOL OF COMPUTR SCIC A LVL 2 MODUL, SPRIG SMSTR 2015 2016 MACHIS AD THIR LAGUAGS ASWRS Time llowed TWO hours Cndidtes my omplete the front over of their nswer ook nd sign their
More informationCSE 401 Compilers. Today s Agenda
CSE 401 Compilers Leture 3: Regulr Expressions & Snning, on?nued Mihel Ringenurg Tody s Agend Lst?me we reviewed lnguges nd grmmrs, nd riefly strted disussing regulr expressions. Tody I ll restrt the regulr
More informationCS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions
CS 330 Forml Methods nd Models Dn Richrds, George Mson University, Spring 2016 Quiz Solutions Quiz 1, Propositionl Logic Dte: Ferury 9 1. (4pts) ((p q) (q r)) (p r), prove tutology using truth tles. p
More informationFinite State Automata and Determinisation
Finite Stte Automt nd Deterministion Tim Dworn Jnury, 2016 Lnguges fs nf re df Deterministion 2 Outline 1 Lnguges 2 Finite Stte Automt (fs) 3 Non-deterministi Finite Stte Automt (nf) 4 Regulr Expressions
More informationParsing and Pattern Recognition
Topics in IT Prsing nd Pttern Recognition Week Context-Free Prsing College of Informtion Science nd Engineering Ritsumeikn University this week miguity in nturl lnguge in mchine lnguges top-down, redth-first
More informationSystem Validation (IN4387) November 2, 2012, 14:00-17:00
System Vlidtion (IN4387) Novemer 2, 2012, 14:00-17:00 Importnt Notes. The exmintion omprises 5 question in 4 pges. Give omplete explntion nd do not onfine yourself to giving the finl nswer. Good luk! Exerise
More informationParse trees, ambiguity, and Chomsky normal form
Prse trees, miguity, nd Chomsky norml form In this lecture we will discuss few importnt notions connected with contextfree grmmrs, including prse trees, miguity, nd specil form for context-free grmmrs
More informationCS 330 Formal Methods and Models
CS 330 Forml Methods nd Models Dn Richrds, George Mson University, Spring 2017 Quiz Solutions Quiz 1, Propositionl Logic Dte: Ferury 2 1. Prove ((( p q) q) p) is tutology () (3pts) y truth tle. p q p q
More information2.4 Theoretical Foundations
2 Progrmming Lnguge Syntx 2.4 Theoretil Fountions As note in the min text, snners n prsers re se on the finite utomt n pushown utomt tht form the ottom two levels of the Chomsky lnguge hierrhy. At eh level
More informationCS 275 Automata and Formal Language Theory
CS 275 utomt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Prolem (II) Chpter II.5.: Properties of Context Free Grmmrs (14) nton Setzer (Bsed on ook drft y J. V. Tucker nd K. Stephenson)
More informationNormal Forms for Context-free Grammars
Norml Forms for Context-free Grmmrs 1 Linz 6th, Section 6.2 wo Importnt Norml Forms, pges 171--178 2 Chomsky Norml Form All productions hve form: A BC nd A vrile vrile terminl 3 Exmples: S AS S AS S S
More informationTechnische Universität München Winter term 2009/10 I7 Prof. J. Esparza / J. Křetínský / M. Luttenberger 11. Februar Solution
Tehnishe Universität Münhen Winter term 29/ I7 Prof. J. Esprz / J. Křetínský / M. Luttenerger. Ferur 2 Solution Automt nd Forml Lnguges Homework 2 Due 5..29. Exerise 2. Let A e the following finite utomton:
More informationNondeterministic Automata vs Deterministic Automata
Nondeterministi Automt vs Deterministi Automt We lerned tht NFA is onvenient model for showing the reltionships mong regulr grmmrs, FA, nd regulr expressions, nd designing them. However, we know tht n
More informationCompiler Design. Spring Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz
University of Southern Cliforni Computer Siene Deprtment Compiler Design Spring 7 Lexil Anlysis Smple Exerises nd Solutions Prof. Pedro C. Diniz USC / Informtion Sienes Institute 47 Admirlty Wy, Suite
More informationFormal Languages Simplifications of CFGs
Forml Lnguges implifictions of CFGs ubstitution Rule Equivlent grmmr b bc ubstitute b bc bbc b 2 ubstitution Rule b bc bbc ubstitute b bc bbc bc Equivlent grmmr 3 In generl: xz y 1 ubstitute y 1 xz xy1z
More informationCS 573 Automata Theory and Formal Languages
Non-determinism Automt Theory nd Forml Lnguges Professor Leslie Lnder Leture # 3 Septemer 6, 2 To hieve our gol, we need the onept of Non-deterministi Finite Automton with -moves (NFA) An NFA is tuple
More informationThe transformation to right derivation is called the canonical reduction sequence. Bottom-up analysis
Bottom-up nlysis Shift-reduce prsing. Constructs the derivtion tree from ottom to top. Reduces the string to the strt symol. Produces reverse right derivtion. Exmple: G(E): 1. E E + T 2. T 3. T T * F 4.
More informationNondeterministic Finite Automata
Nondeterministi Finite utomt The Power of Guessing Tuesdy, Otoer 4, 2 Reding: Sipser.2 (first prt); Stoughton 3.3 3.5 S235 Lnguges nd utomt eprtment of omputer Siene Wellesley ollege Finite utomton (F)
More informationarxiv: v2 [cs.lo] 24 Feb 2017
Lol Lexing teven Ou University of dinurgh steven.ou@gmil.om Phil ott University of dinurgh phil.sott@ed..u Jques Fleuriot University of dinurgh jdf@inf.ed..u rxiv:1702.03277v2 [s.lo] 24 Fe 2017 strt We
More informationEngr354: Digital Logic Circuits
Engr354: Digitl Logi Ciruits Chpter 4: Logi Optimiztion Curtis Nelson Logi Optimiztion In hpter 4 you will lern out: Synthesis of logi funtions; Anlysis of logi iruits; Tehniques for deriving minimum-ost
More informationSWEN 224 Formal Foundations of Programming WITH ANSWERS
T E W H A R E W Ā N A N G A O T E Ū P O K O O T E I K A A M Ā U I VUW V I C T O R I A UNIVERSITY OF WELLINGTON Time Allowed: 3 Hours EXAMINATIONS 2011 END-OF-YEAR SWEN 224 Forml Foundtions of Progrmming
More informationPrefix-Free Regular-Expression Matching
Prefix-Free Regulr-Expression Mthing Yo-Su Hn, Yjun Wng nd Derik Wood Deprtment of Computer Siene HKUST Prefix-Free Regulr-Expression Mthing p.1/15 Pttern Mthing Given pttern P nd text T, find ll sustrings
More informationLinear Algebra Introduction
Introdution Wht is Liner Alger out? Liner Alger is rnh of mthemtis whih emerged yers k nd ws one of the pioneer rnhes of mthemtis Though, initilly it strted with solving of the simple liner eqution x +
More informationHomework 3 Solutions
CS 341: Foundtions of Computer Science II Prof. Mrvin Nkym Homework 3 Solutions 1. Give NFAs with the specified numer of sttes recognizing ech of the following lnguges. In ll cses, the lphet is Σ = {,1}.
More informationPre-Lie algebras, rooted trees and related algebraic structures
Pre-Lie lgers, rooted trees nd relted lgeri strutures Mrh 23, 2004 Definition 1 A pre-lie lger is vetor spe W with mp : W W W suh tht (x y) z x (y z) = (x z) y x (z y). (1) Exmple 2 All ssoitive lgers
More informationMemory Minimization for Tensor Contractions using Integer Linear Programming.
Memory Minimiztion for Tensor Contrtions using Integer Liner Progrmming A. Allm 1, J. Rmnujm 1, G. Bumgrtner 2, nd P. Sdyppn 3 1 Deprtment of Eletril nd Computer Engineering, Louisin Stte University, USA
More informationProject 6: Minigoals Towards Simplifying and Rewriting Expressions
MAT 51 Wldis Projet 6: Minigols Towrds Simplifying nd Rewriting Expressions The distriutive property nd like terms You hve proly lerned in previous lsses out dding like terms ut one prolem with the wy
More informationCS 275 Automata and Formal Language Theory
CS 275 Automt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Problem (II) Chpter II.5.: Properties of Context Free Grmmrs (14) Anton Setzer (Bsed on book drft by J. V. Tucker nd K. Stephenson)
More informationELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-378: Computer Hardware Design Winter Notes - Unit 1
ELETRIL ND OMPUTER ENGINEERING DEPRTMENT, OKLND UNIVERSIT EE-78: omputer Hrdwre Design Winter 016 INTRODUTION TO LOGI IRUITS Notes - Unit 1 OOLEN LGER This is the oundtion or designing nd nlyzing digitl
More informationELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-2700: Digital Logic Design Fall Notes - Unit 1
INTRODUTION TO LOGI IRUITS Notes - Unit 1 OOLEN LGER This is the oundtion or designing nd nlyzing digitl systems. It dels with the cse where vriles ssume only one o two vlues: TRUE (usully represented
More informationMatrices SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics (c) 1. Definition of a Matrix
tries Definition of tri mtri is regulr rry of numers enlosed inside rkets SCHOOL OF ENGINEERING & UIL ENVIRONEN Emple he following re ll mtries: ), ) 9, themtis ), d) tries Definition of tri Size of tri
More informationChapter 4 Regular Grammar and Regular Sets. (Solutions / Hints)
C K Ngpl Forml Lnguges nd utomt Theory Chpter 4 Regulr Grmmr nd Regulr ets (olutions / Hints) ol. (),,,,,,,,,,,,,,,,,,,,,,,,,, (),, (c) c c, c c, c, c, c c, c, c, c, c, c, c, c c,c, c, c, c, c, c, c, c,
More informationBİL 354 Veritabanı Sistemleri. Relational Algebra (İlişkisel Cebir)
BİL 354 Veritnı Sistemleri Reltionl lger (İlişkisel Ceir) Reltionl Queries Query lnguges: llow mnipultion nd retrievl of dt from dtse. Reltionl model supports simple, powerful QLs: Strong forml foundtion
More informationCS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University
CS415 Compilers Lexicl Anlysis nd These slides re sed on slides copyrighted y Keith Cooper, Ken Kennedy & Lind Torczon t Rice University First Progrmming Project Instruction Scheduling Project hs een posted
More informationTIME AND STATE IN DISTRIBUTED SYSTEMS
Distriuted Systems Fö 5-1 Distriuted Systems Fö 5-2 TIME ND STTE IN DISTRIUTED SYSTEMS 1. Time in Distriuted Systems Time in Distriuted Systems euse eh mhine in distriuted system hs its own lok there is
More informationConvert the NFA into DFA
Convert the NF into F For ech NF we cn find F ccepting the sme lnguge. The numer of sttes of the F could e exponentil in the numer of sttes of the NF, ut in prctice this worst cse occurs rrely. lgorithm:
More information@#? Text Search ] { "!" Nondeterministic Finite Automata. Transformation NFA to DFA and Simulation of NFA. Text Search Using Automata
g Text Serh @#? ~ Mrko Berezovský Rdek Mřík PAL 0 Nondeterministi Finite Automt n Trnsformtion NFA to DFA nd Simultion of NFA f Text Serh Using Automt A B R Power of Nondeterministi Approh u j Regulr Expression
More informationNon-deterministic Finite Automata
Non-deterministic Finite Automt Eliminting non-determinism Rdoud University Nijmegen Non-deterministic Finite Automt H. Geuvers nd T. vn Lrhoven Institute for Computing nd Informtion Sciences Intelligent
More informationILLUSTRATING THE EXTENSION OF A SPECIAL PROPERTY OF CUBIC POLYNOMIALS TO NTH DEGREE POLYNOMIALS
ILLUSTRATING THE EXTENSION OF A SPECIAL PROPERTY OF CUBIC POLYNOMIALS TO NTH DEGREE POLYNOMIALS Dvid Miller West Virgini University P.O. BOX 6310 30 Armstrong Hll Morgntown, WV 6506 millerd@mth.wvu.edu
More informationPetri Nets. Rebecca Albrecht. Seminar: Automata Theory Chair of Software Engeneering
Petri Nets Ree Alreht Seminr: Automt Theory Chir of Softwre Engeneering Overview 1. Motivtion: Why not just using finite utomt for everything? Wht re Petri Nets nd when do we use them? 2. Introdution:
More informationI. Theory of Automata II. Theory of Formal Languages III. Theory of Turing Machines
CI 3104 /Winter 2011: Introduction to Forml Lnguges Chpter 16: Non-Context-Free Lnguges Chpter 16: Non-Context-Free Lnguges I. Theory of utomt II. Theory of Forml Lnguges III. Theory of Turing Mchines
More informationCSCI565 - Compiler Design
CSCI565 - Compiler Deign Spring 6 Due Dte: Fe. 5, 6 t : PM in Cl Prolem [ point]: Regulr Expreion nd Finite Automt Develop regulr expreion (RE) tht detet the longet tring over the lphet {-} with the following
More information= state, a = reading and q j
4 Finite Automt CHAPTER 2 Finite Automt (FA) (i) Derterministi Finite Automt (DFA) A DFA, M Q, q,, F, Where, Q = set of sttes (finite) q Q = the strt/initil stte = input lphet (finite) (use only those
More informationTest Generation from Timed Input Output Automata
Chpter 8 Test Genertion from Timed Input Output Automt The purpose of this hpter is to introdue tehniques for the genertion of test dt from models of softwre sed on vrints of timed utomt. The tests generted
More information5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.
Regulr Expressions, Pumping Lemm, Right Liner Grmmrs Ling 106 Mrch 25, 2002 1 Regulr Expressions A regulr expression descries or genertes lnguge: it is kind of shorthnd for listing the memers of lnguge.
More informationAlpha Algorithm: A Process Discovery Algorithm
Proess Mining: Dt Siene in Ation Alph Algorithm: A Proess Disovery Algorithm prof.dr.ir. Wil vn der Alst www.proessmining.org Proess disovery = Ply-In Ply-In event log proess model Ply-Out Reply proess
More informationRefined interfaces for compositional verification
Refined interfces for compositionl verifiction Frédéric Lng INRI Rhône-lpes http://www.inrilpes.fr/vsy Motivtion Enumertive verifiction of concurrent systems Prllel composition of synchronous processes
More informationXML and Databases. Outline. 1. Top-Down Evaluation of Simple Paths. 1. Top-Down Evaluation of Simple Paths. 1. Top-Down Evaluation of Simple Paths
Outline Leture Effiient XPth Evlution XML n Dtses. Top-Down Evlution of simple pths. Noe Sets only: Core XPth. Bottom-Up Evlution of Core XPth. Polynomil Time Evlution of Full XPth Sestin Mneth NICTA n
More informationDigital Circuit Design
2017-10-11 0 Introdution Digitl Ciruit Design Eri Hehner University of Toronto The word iruit is relted to the word irle. It ws used to desrie losed eletril pth tht goes from one end of n eletril ttery,
More information5. Every rational number have either terminating or repeating (recurring) decimal representation.
CHAPTER NUMBER SYSTEMS Points to Rememer :. Numer used for ounting,,,,... re known s Nturl numers.. All nturl numers together with zero i.e. 0,,,,,... re known s whole numers.. All nturl numers, zero nd
More informationChapter 3. Vector Spaces. 3.1 Images and Image Arithmetic
Chpter 3 Vetor Spes In Chpter 2, we sw tht the set of imges possessed numer of onvenient properties. It turns out tht ny set tht possesses similr onvenient properties n e nlyzed in similr wy. In liner
More informationCyclic Inputs. Surface Generation (Part II) Ambiguity-preserving Generation. Ambiguity-preserving Generation. Ambiguity-preserving Generation
Cyli Inputs The set of strings tht grmmr reltes to yli input struture might e non-ontext-free Surfe Genertion (Prt II) Amiguity-preserving Genertion Amiguity-preserving Genertion Motivtion Motivtion ()
More informationAVL Trees. D Oisín Kidney. August 2, 2018
AVL Trees D Oisín Kidne August 2, 2018 Astrt This is verified implementtion of AVL trees in Agd, tking ides primril from Conor MBride s pper How to Keep Your Neighours in Order [2] nd the Agd stndrd lirr
More informationLanguages and Computation (G52LAC) Lecture notes Spring 2018
Lnguges nd Computtion (G52LAC) Leture notes Spring 28 Thorsten Altenkirh, Vennzio Cprett, nd Henrik Nilsson Contents Ferury 2, 28 Introdution 4. Exmple: Vlid Jv progrms................... 4.2 Exmple: The
More informationAssignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages
Deprtment of Computer Science, Austrlin Ntionl University COMP2600 Forml Methods for Softwre Engineering Semester 2, 206 Assignment Automt, Lnguges, nd Computility Smple Solutions Finite Stte Automt nd
More informationNFAs continued, Closure Properties of Regular Languages
lgorithms & Models of omputtion S/EE 374, Spring 209 NFs continued, losure Properties of Regulr Lnguges Lecture 5 Tuesdy, Jnury 29, 209 Regulr Lnguges, DFs, NFs Lnguges ccepted y DFs, NFs, nd regulr expressions
More informationCS 330 Formal Methods and Models
CS 330 Forml Methods nd Models Dn Richrds, section 003, George Mson University, Fll 2017 Quiz Solutions Quiz 1, Propositionl Logic Dte: Septemer 7 1. Prove (p q) (p q), () (5pts) using truth tles. p q
More informationCS 330 Formal Methods and Models
CS 0 Forml Methods nd Models Dn Richrds, George Mson University, Fll 2016 Quiz Solutions Quiz 1, Propositionl Logic Dte: Septemer 8 1. Prove q (q p) p q p () (4pts) with truth tle. p q p q p (q p) p q
More informationCHAPTER 1 Regular Languages. Contents
Finite Automt (FA or DFA) CHAPTE 1 egulr Lnguges Contents definitions, exmples, designing, regulr opertions Non-deterministic Finite Automt (NFA) definitions, euivlence of NFAs nd DFAs, closure under regulr
More informationThoery of Automata CS402
Thoery of Automt C402 Theory of Automt Tle of contents: Lecture N0. 1... 4 ummry... 4 Wht does utomt men?... 4 Introduction to lnguges... 4 Alphets... 4 trings... 4 Defining Lnguges... 5 Lecture N0. 2...
More information3 Regular expressions
3 Regulr expressions Given n lphet Σ lnguge is set of words L Σ. So fr we were le to descrie lnguges either y using set theory (i.e. enumertion or comprehension) or y n utomton. In this section we shll
More informationTable of contents: Lecture N Summary... 3 What does automata mean?... 3 Introduction to languages... 3 Alphabets... 3 Strings...
Tle of contents: Lecture N0.... 3 ummry... 3 Wht does utomt men?... 3 Introduction to lnguges... 3 Alphets... 3 trings... 3 Defining Lnguges... 4 Lecture N0. 2... 7 ummry... 7 Kleene tr Closure... 7 Recursive
More information2. Lexical Analysis. Oscar Nierstrasz
2. Lexicl Anlysis Oscr Nierstrsz Thnks to Jens Plserg nd Tony Hosking for their kind permission to reuse nd dpt the CS132 nd CS502 lecture notes. http://www.cs.ucl.edu/~plserg/ http://www.cs.purdue.edu/homes/hosking/
More informationFor a, b, c, d positive if a b and. ac bd. Reciprocal relations for a and b positive. If a > b then a ab > b. then
Slrs-7.2-ADV-.7 Improper Definite Integrls 27.. D.dox Pge of Improper Definite Integrls Before we strt the min topi we present relevnt lger nd it review. See Appendix J for more lger review. Inequlities:
More informationSome Theory of Computation Exercises Week 1
Some Theory of Computtion Exercises Week 1 Section 1 Deterministic Finite Automt Question 1.3 d d d d u q 1 q 2 q 3 q 4 q 5 d u u u u Question 1.4 Prt c - {w w hs even s nd one or two s} First we sk whether
More informationNON-DETERMINISTIC FSA
Tw o types of non-determinism: NON-DETERMINISTIC FS () Multiple strt-sttes; strt-sttes S Q. The lnguge L(M) ={x:x tkes M from some strt-stte to some finl-stte nd ll of x is proessed}. The string x = is
More informationCS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS
CS 310 (sec 20) - Winter 2003 - Finl Exm (solutions) SOLUTIONS 1. (Logic) Use truth tles to prove the following logicl equivlences: () p q (p p) (q q) () p q (p q) (p q) () p q p q p p q q (q q) (p p)
More informationNFAs continued, Closure Properties of Regular Languages
Algorithms & Models of Computtion CS/ECE 374, Fll 2017 NFAs continued, Closure Properties of Regulr Lnguges Lecture 5 Tuesdy, Septemer 12, 2017 Sriel Hr-Peled (UIUC) CS374 1 Fll 2017 1 / 31 Regulr Lnguges,
More informationMaintaining Mathematical Proficiency
Nme Dte hpter 9 Mintining Mthemtil Profiieny Simplify the epression. 1. 500. 189 3. 5 4. 4 3 5. 11 5 6. 8 Solve the proportion. 9 3 14 7. = 8. = 9. 1 7 5 4 = 4 10. 0 6 = 11. 7 4 10 = 1. 5 9 15 3 = 5 +
More informationXML and Databases. Exam Preperation Discuss Answers to last year s exam. Sebastian Maneth NICTA and UNSW
XML n Dtses Exm Prepertion Disuss Answers to lst yer s exm Sestin Mneth NICTA n UNSW CSE@UNSW -- Semester 1, 2008 (1) For eh of the following, explin why it is not well-forme XML (is WFC or the XML grmmr
More informationThe University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER LANGUAGES AND COMPUTATION ANSWERS
The University of Nottinghm SCHOOL OF COMPUTER SCIENCE LEVEL 2 MODULE, SPRING SEMESTER 2016 2017 LNGUGES ND COMPUTTION NSWERS Time llowed TWO hours Cndidtes my complete the front cover of their nswer ook
More informationVectors. a Write down the vector AB as a column vector ( x y ). A (3, 2) x point C such that BC = 3. . Go to a OA = a
Streth lesson: Vetors Streth ojetives efore you strt this hpter, mrk how onfident you feel out eh of the sttements elow: I n lulte using olumn vetors nd represent the sum nd differene of two vetors grphilly.
More informationReview for the Midterm
Review for the Midterm Stephen A. Edwrds Columi University Fll 2018 The Midterm Structure of Compiler Scnning Lnguges nd Regulr Expressions NFAs Trnslting REs into NFAs: Thompson s Construction Building
More informationUnit 4. Combinational Circuits
Unit 4. Comintionl Ciruits Digitl Eletroni Ciruits (Ciruitos Eletrónios Digitles) E.T.S.I. Informáti Universidd de Sevill 5/10/2012 Jorge Jun 2010, 2011, 2012 You re free to opy, distriute
More informationRegular languages refresher
Regulr lnguges refresher 1 Regulr lnguges refresher Forml lnguges Alphet = finite set of letters Word = sequene of letter Lnguge = set of words Regulr lnguges defined equivlently y Regulr expressions Finite-stte
More informationChapter 4 State-Space Planning
Leture slides for Automted Plnning: Theory nd Prtie Chpter 4 Stte-Spe Plnning Dn S. Nu CMSC 722, AI Plnning University of Mrylnd, Spring 2008 1 Motivtion Nerly ll plnning proedures re serh proedures Different
More information, g. Exercise 1. Generator polynomials of a convolutional code, given in binary form, are g. Solution 1.
Exerise Genertor polynomils of onvolutionl ode, given in binry form, re g, g j g. ) Sketh the enoding iruit. b) Sketh the stte digrm. ) Find the trnsfer funtion T. d) Wht is the minimum free distne of
More informationGreedy regular expression matching
Alin Frisch INRIA Luc Crdelli MSRC 2004-05-15 ICALP The mtching prolem The prolem Project the structure of regulr expression on flt sequence. R = ( ) w = 1 2 1 2 3 v = [1 : [ 1 ; 2 ]; 2 : 1 ; 2 : 2 ; 1
More informationq 2 in δ 2. [4: 1 mark q 1 in δ 1 and q 2 and (q 1, q 2 ) (q 1, q 2) whenever q 1 for each component] (b) The resulting DFA:
Module Title: Informtics 2A Exm Diet (Dec/April/Aug): Aug 2015 Brief notes on nswers: 1. () Lexing: The input is progrm text [1].The output is strem of lexemes pired with their lexicl clsses [1]. For exmple
More informationReview: The Riemann Integral Review: The definition of R b
eview: The iemnn Integrl eview: The definition of b f (x)dx. For ontinuous funtion f on the intervl [, b], Z b f (x) dx lim mx x i!0 nx i1 f (x i ) x i. This limit omputes the net (signed) re under the
More informationCS 275 Automata and Formal Language Theory
CS 275 Automt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Problem (II) Chpter II.6.: Push Down Automt Remrk: This mteril is no longer tught nd not directly exm relevnt Anton Setzer (Bsed
More informationCHAPTER 1 PROGRAM OF MATRICES
CHPTER PROGRM OF MTRICES -- INTRODUCTION definition of engineering is the science y which the properties of mtter nd sources of energy in nture re mde useful to mn. Thus n engineer will hve to study the
More informationChapter 8 Roots and Radicals
Chpter 8 Roots nd Rdils 7 ROOTS AND RADICALS 8 Figure 8. Grphene is n inredily strong nd flexile mteril mde from ron. It n lso ondut eletriity. Notie the hexgonl grid pttern. (redit: AlexnderAIUS / Wikimedi
More informationA Functorial Query Language
A Funtoril Query Lnguge Ryn Wisnesky, Dvid Spivk Deprtment of Mthemtis Msshusetts Institute of Tehnology {wisnesky, dspivk}@mth.mit.edu Presented t Boston Hskell April 16, 2014 Outline Introdution to FQL.
More informationFor convenience, we rewrite m2 s m2 = m m m ; where m is repeted m times. Since xyz = m m m nd jxyj»m, we hve tht the string y is substring of the fir
CSCI 2400 Models of Computtion, Section 3 Solutions to Homework 4 Problem 1. ll the solutions below refer to the Pumping Lemm of Theorem 4.8, pge 119. () L = f n b l k : k n + lg Let's ssume for contrdiction
More informationI. Theory of Automata II. Theory of Formal Languages III. Theory of Turing Machines
CI 3104 /Winter 2011: Introduction to Forml Lnguges Chter 13: Grmmticl Formt Chter 13: Grmmticl Formt I. Theory of Automt II. Theory of Forml Lnguges III. Theory of Turing Mchines Dr. Neji Zgui CI3104-W11
More informationScanner. Specifying patterns. Specifying patterns. Operations on languages. A scanner must recognize the units of syntax Some parts are easy:
Scnner Specifying ptterns source code tokens scnner prser IR A scnner must recognize the units of syntx Some prts re esy: errors mps chrcters into tokens the sic unit of syntx x = x + y; ecomes
More informationLecture 09: Myhill-Nerode Theorem
CS 373: Theory of Computtion Mdhusudn Prthsrthy Lecture 09: Myhill-Nerode Theorem 16 Ferury 2010 In this lecture, we will see tht every lnguge hs unique miniml DFA We will see this fct from two perspectives
More informationA Lower Bound for the Length of a Partial Transversal in a Latin Square, Revised Version
A Lower Bound for the Length of Prtil Trnsversl in Ltin Squre, Revised Version Pooy Htmi nd Peter W. Shor Deprtment of Mthemtil Sienes, Shrif University of Tehnology, P.O.Bo 11365-9415, Tehrn, Irn Deprtment
More informationENGR 3861 Digital Logic Boolean Algebra. Fall 2007
ENGR 386 Digitl Logi Boole Alger Fll 007 Boole Alger A two vlued lgeri system Iveted y George Boole i 854 Very similr to the lger tht you lredy kow Sme opertios ivolved dditio sutrtio multiplitio Repled
More informationarxiv: v1 [cs.fl] 13 Oct 2010
Regulr Expressions, u point Andre Asperti Deprtment of Computer Siene, University of Bologn Mur Anteo Zmoni 7, 40127, Bologn, ITALY sperti@s.unio.it Cludio Serdoti Coen Deprtment of Computer Siene, University
More informationUnfoldings of Networks of Timed Automata
Unfolings of Networks of Time Automt Frnk Cssez Thoms Chtin Clue Jr Ptrii Bouyer Serge H Pierre-Alin Reynier Rennes, Deemer 3, 2008 Unfolings [MMilln 93] First efine for Petri nets Then extene to other
More informationLecture Notes No. 10
2.6 System Identifition, Estimtion, nd Lerning Leture otes o. Mrh 3, 26 6 Model Struture of Liner ime Invrint Systems 6. Model Struture In representing dynmil system, the first step is to find n pproprite
More information