Table-driven look-ahead lexical analysis
|
|
- Mark McKenzie
- 5 years ago
- Views:
Transcription
1 Tle-riven look-he lexil nlysis WUU YANG Computer n Informtion Siene Deprtment Ntionl Chio-Tung University, HsinChu, Tiwn, R.O.C. Astrt. Moern progrmming lnguges use regulr expressions to efine vli tokens. Tritionl lexil nlyzers se on minimum eterministi finite utomt for regulr expressions nnot hnle the look-he prolem. The snner writer nees to expliitly ientify the look-he sttes n oe the uffering n re-snning opertions y hn. We ientify the lss of finite look-he finite utomt, whih is generl enough to inlue ll finite utomt of prtil lexil nlyzers. Finite look-he finite utomt re then trnsforme into suffix finite utomt. A new lexil nlyzer mkes use of the suffix finite utomt to ientify tokens. The new lexil nlyzer solves the look-he prolem in tle-riven pproh n it n etet lexil errors t n erlier time thn tritionl lexil nlyzers. The extr ost of the new lexil nlyzers is the lrger stte trnsition tle n three itionl 1-imensionl tles. Keywors: ompilers, finite utomt, finite-lookhe finite utomt, inrementl lexil nlysis, lnguge proessors, lexil nlysis, regulr expressions, suffix finite utomt 1. Introution Moern progrmming lnguges use regulr expressions to efine vli tokens. A snner is uilt from the finite utomton (FA) tht orrespons to the set of regulr expressions. In etermining the en of token, snner usully nees to exmine n extr symol from the input. This is lle 1-symol lookhe. In some ses, the snner nees to look he multiple symols. For instne, to sn in Psl n A, the snner nees to look he two symols (i.e., the two ".") fter the 10 []. A similr exmple in Fortrn is "10.EQ.IX". There re two iffiulties when the snner nees to look he symols. First, the previewe symols re usully hnle y uffering mehnism. The size of the uffer must e no less thn the mximum numer of look-he symols require y the snner. It is not strightforwr to etermine the mximum numer of look-he symols from the regulr-expression speifition of tokens. Seon, the previewe symols must e uffere n re-snne when the next token is requeste. For snner genertors tht generte trnsition tles, rther thn oe, the uffering n re-snning opertions must e expliitly ientifie n hn-oe y the snner writer. Though some snner genertors my utomtilly generte oe to solve the look-he prolem, these genertors work only in n ho wy. Aoring to Pxson, the look-he prolem (lle ktrking in flex) is "messy n often my e n enormous mount of work for omplite snner". The look-he prolem origintes from the longest-mth onvention, whih sttes tht the snner shoul fin, strting from the urrent lotion of the input, longest string stisfying token efinition. This onvention n e trnslte into the stte-trnsition ehvior of the finite utomt of the regulr expressions. A tritionl snner mkes stte trnsitions oring to finite utomton. When the This work ws supporte in prt y Ntionl Siene Counil, Tiwn, R.O.C. uner grnts NSC E T n NSC S CL. Copyright 1994 y Wuu Yng. All rights reserve. An extene version of this pper hs een epte y At Informti.
2 snner fils to trnsit to next stte, it etermines the en of the urrent token n puts the previewe symols into uffer. The finite utomton tht unerlies the tritionl snner is usully eterministi n minimum. The reson for hoosing the minimum eterministi FA is to reue the size of the trnsition tle of the snner. However, the minimum eterministi FA oes not help the snner to eie the en of urrent token n to proess the previewe symols. By using suffix finite utomton, we n uil new snners tht solve the look-he prolem in tle-riven pproh. The snner writer is ompletely free from onerns of the look-he prolem. The suffix utomt re lso relte to prllel lexil nlysis. For the ske of revity, prllel lexil nlysis is omitte from the pper.. The ompute-lookhe lgorithm Given set of regulr expressions efining tokens for progrmming lnguge, n lgorithm is presente in this setion tht etermines the mximum numer of look-he symols require y the snner. We ssume tht the snner employs the longest-mth onvention to resolve onflits. The input is string of symols. There is finite voulry of istint symols. We use α, β, n γ to enote strings of symols. The length of string α, enote y α, is the numer of symols in it. The nottion α β mens α is proper prefix of β. A yle in irete grph is pth tht strts n ens t the sme stte (or noe). In DFA, there is n initil stte n one or more epting sttes. The initil stte is pointe to y n rrow whose til is lele strt; the epting sttes re inite y oule irles. An exmple FA is shown in Figure. An epting-to-epting pth is pth from n epting stte to n epting stte tht oes not pss through ny epting sttes, exept the first n the lst epting sttes on the pth. The first n the lst epting sttes on n epting-to-epting pth nee not e istint. Definition. A finite-lookhe finite utomton (FFA) is eterministi finite utomton tht looks he t most finite numer of input symols when etermining the en of token. Consier the exmple of in Psl or A gin. A lose look revels tht the reson why the snner nees to look he two symols fter the 10 is euse oth the integer 10 n eiml numer suh s 10. re vli tokens ut 10. is not. This oservtion les to the following theorem. Theorem 1. The mximum numer of lookhe symols require y the snner = mx ( γ α ), where α n γ re vli tokens, α γ, n for ll β suh tht α β γ, β is not vli token. The mximum numer of look-he symols is the length of the longest epting-to-epting pths. This length is ompute y moifie ynmi progrmming metho. Exmple. Consier the two regulr expressions: { { } * } * n { } * { { } * } *. A eterministi finite utomton orresponing to the two regulr expressions is shown in Figure (). The sttes re numere 1 through. Stte 4 is the initil stte; sttes 4 n re epting sttes. In this exmple, 4 is the length of the epting-to-epting pth 1. This mens the snner nees to look he t most 4 symols in orer to etet the en of token. Figure () is expline in the next setion. The following theorem emonstrtes tht the mximum numer of look-he symols is etermine from the regulr expressions, rther thn the prtiulr DFA hosen for the regulr expressions. Theorem. Let M 1 n M e equivlent DFAs. The mximum numers of look-he symols require y M 1 n M re the sme. Corollry. Let M 1 n M e equivlent DFAs. M 1 is n FFA if n only M is n FFA.
3 Algorithm: Compute-Lookhe /* Given set of regulr expressions, this lgorithm etermines the mximum numer */ /* of lookhe symols require y the snner. */ Trnsform the set of regulr expressions into eterministi finite utomton. Numer the non-epting sttes 1,,..., k ; numer the epting sttes k +1, k +,..., n. Delete ll sttes tht re not rehle from n epting stte n ll epting sttes. Chek whether there is ny yle in the resulting grph. if the resulting grph ontins yles then return( ) /* the FA is not n FFA */ Put ll the sttes n eges elete in the ove step k into the grph. for := 1 to n o for := 1 to n o if = then A 0 [, ] := 0 else if there n ege then A 0 [, ] := 1 else A 0 [, ] := for i := 1 to k o for := 1 to n o for := 1 to n o A i [, ] := mx ( A i 1 [, ], A i 1 [, i ] + A i 1 [i, ] ) The mximum numer of lookhe symols require y the snner is the mximum of A k [, ], where = k +1,..., n n = k +1,..., n. Figure 1. The Compute-Lookhe Algorithm strt 4 1 () DFA 6 strt 4 1 () suffix FA () steps in the ynmi progrmming A A A 1 4 A Figure. An exmple to illustrte the Compute-Lookhe lgorithm. It is our opinion tht ll rel-worl snners shoul use only finite-lookhe FAs sine it is iffiult to hnle potentilly unoune uffer. Furthermore, n FA tht my look he n infinite numer of symols nees O (n ) time on input of length n. By ontrst, finite-lookhe FA nees only O (n ) time on ny input of length n.
4 4. Suffix finite utomt When the DFAs orresponing to the regulr expressions re FFAs, tle-riven look-he snners n e uilt for the regulr expressions. A pth on DFA n e ivie into segments y the epting sttes on the pth. The lst segment on the pth is lle the suffix. Definition. A suffix of non-epting stte s is pth from n epting stte to s tht oes not go through ny epting sttes. If stte is not rehle from ny epting sttes, its suffix is the empty pth. The suffix of n epting stte is lwys the empty pth. Definition. A suffix FA (SFA) is eterministi finite utomton in whih, for eh stte s, ll the suffixes of stte s rry the sme lels. In suffix FA, eh stte s hs unique suffix lel. This suffix lel represents the look-he symols when the finite utomton hlts t stte s. Note tht ll SFAs re lso FFAs n only FFAs hve equivlent SFAs. To trnsform n FFA into n equivlent SFA, we split ll the non-epting sttes tht hve two or more ifferent suffixes. For instne, onsier stte 1 in Figure (). Stte 1 hs two ifferent suffixes, tht is, the two pths 1 n 4 1, whih re lele n, respetively. After splitting stte 1, we get n equivlent suffix FA shown in Figure (). Theorem 4. All n only FFAs hve equivlent SFAs. 4. Lexil tles The suffix FA is the sis for the new snner. In ition to the tritionl stte trnsition tle, three new tles re generte: ontinution tle, n tion tle, n n output tle. Rememer tht the suffix lels of stte s represent the previewe symols from input when the snner hlts t stte s. When the next token is requeste, this suffix lel shoul e snne gin. Sine in n SFA, eh stte hs unique suffix lel, it is possile to pre-ompute the pth whih the SFA psses through when the suffix lel of stte is fe into the SFA. We first efine funtion f inl tht tkes string s rgument n returns pir, of whih the first is sequene of tokens n the seon is string. Roughly speking, f inl (α) returns the output of the SFA n the remining suffix of α when α is use s input. Given string α, if the SFA n sn α ompletely, then f inl (α) = (nil, α). On the other hn, if the SFA nnot sn α ompletely n some non-null prefix of α n move the SFA to n epting stte, let β e the longest prefix of α tht moves the SFA from the initil stte to n epting stte f. We my write α s βα. Then f inl (α) = (ont (Tf, f irst (f inl (α ))), seon (f inl (α ))), where Tf is the token ssoite with stte f, f irst n seon return the first n seon elements of pir, respetively, n ont ontente token to sequene. If the SFA nnot sn α ompletely n no prefix of α n move the SFA to n epting stte, f inl (α) = (nil, error ). There is one entry for eh stte of the SFA in the ontinution, tion, n output tles. These entries re etermine from the suffix lel of the stte. Let α e the suffix lel of stte s. Output [s ] is f irst (f inl (α)). If seon (f inl (α)) is not error, let p e the pth whih the SFA psses through when seon (f inl (α)) is use s input. Continution [s ] is the lst stte on the pth p. Ation [s ] is the token ssoite with the lst epting stte on the pth p, exept the very first initil stte (note tht the initil stte might well e n epting stte). If there is no epting stte on the pth p, exept the very first initil stte, tion [s ] is NULL.
5 Suppose seon (f inl (α)) is n error. Then ontinution [s ] is error, whih mens tht the SFA eventully etets the lexil error when the suffix lel α of stte s is use s input. Ation [s ] is NULL in this se. Exmple. Figure 4() shows n FFA. An equivlent SFA is shown in Figure 4(). We will explin the WSFA of Figure 4() lter. The three tles re shown in Figure 4().. The new snner river Figure is the snner river. It mkes use of the stte trnsition tle for hnging the sttes of the SFA. A vrile token is use to reor the token ssoite with the lst epting stte tht the SFA psses through uring the trnsitions. Let s e the stte when the SFA nnot mke further trnsition. The token in the vrile token is reognize n printe. The suffix lel of stte s represents the previewe symols. When the suffix lel is fe into the SFA, we know tht the tokens in output [s ] will e reognize. Hene, they re printe one y one. Finlly, the SFA will reh the stte speifie y ontinution [s ]. Ation [s ] is the token ssoite with the lst epting stte when the suffix lel of s is fe into the SFA, fter ll the tokens in output [s ] re reognize. () FFA strt () SFA strt () WSFA strt () CON, ACT, n OUT tles sttes CON error 6 7 ACT NULL NULL T6 T7 NULL NULL NULL T NULL T6 T7 OUT nil nil nil nil nil nil nil nil T nil nil Figure 4. An FFA, its equivlent SFA n WSFA, the ontinution, tion, n output tles of the SFA.
6 6 Algorithm: New-Snner-Driver /* Given the stte trnsition tle ST, the ontinution tle CON, the tion tle*/ /* ACT, n the output tle OUT of n SFA, the snner river groups symols*/ /* from input into tokens. We ssume tht there is no trnsition from ny stte*/ /* when the next input symol is the en-of-file symol. */ urrent_stte := the initil stte of the SFA token := NULL next_symol := next symol from input repet if ST [urrent_stte, next_symol ] no-trnsition then egin urrent_stte := ST [urrent_stte, next_symol ] if urrent_stte is n epting stte then token := the token ssoite with the stte urrent_stte next_symol := next symol from input en else /* no trnsition is possile t this point. */ if token = NULL then lexil_error () else egin print token print the tokens in OUT [urrent_stte ] token := ACT [urrent_stte ] if CON [urrent_stte ] is error then lexil_error () else urrent_stte := CON [urrent_stte ] en until next_symol = en-of-file n urrent_stte = the initil stte of the SFA Figure. The new snner-river. In the suffix FA, ll suffixes of stte rry the sme lel. This requirement is too strong for the purpose of lexil nlysis. For instne, stte in the FFA of Figure 4() is split into three sttes, 8, n 10 ue to ifferent suffixes. However, sttes n 10 my e omine into single stte sine their entries in the ontinution, tion, n output tles re the sme, respetively. Similrly, sttes 4 n 11 my e omine. The resulting FA is shown in Figure 4(). Bse on the ove oservtion, we introue the notion of wek suffix FA. 6. Conlusion n relte work The look-he prolem is exmine in etil in this pper. It is foun tht tritionl snners se on minimum eterministi finite utomt solve the look-he prolem in n ho wy. We propose new tle-riven snner tht solves the look-he prolem utomtilly. There re mny pulishe reports on lexil nlysis. They inlue lex, sngen, flex, TOOLS, Alex, LexAGen, Nwroki s work, GLA, Rex, Mksn, ALADIN, n Glxy. (Referenes to these works re ville from the uthor.) Our pproh to the look-he prolem is similr in spirit to the string pttern mthing lgorithm [] n the string mthing lgorithm [1]. REFERENCES 1. Aho, A.V. n Corsik, M.J., Effiient string mthing: An i to iliogrphi serh, Comm. ACM 18(6) pp. -40 (June 197).. Fisher, C.N. n LeBln, R.J. Jr., Crfting Compiler with C, Benjmin/Cummings, Reing, MA (1991).. Knuth, D.E., Morris, Jr., J.H., n Prtt, V.R., Fst pttern mthing in strings, SIAM J. on Computing 6()(1977).
CS 241 Week 4 Tutorial Solutions
CS 4 Week 4 Tutoril Solutions Writing n Assemler, Prt & Regulr Lnguges Prt Winter 8 Assemling instrutions utomtilly. slt $d, $s, $t. Solution: $d, $s, nd $t ll fit in -it signed integers sine they re 5-it
More information10.2 Graph Terminology and Special Types of Graphs
10.2 Grph Terminology n Speil Types of Grphs Definition 1. Two verties u n v in n unirete grph G re lle jent (or neighors) in G iff u n v re enpoints of n ege e of G. Suh n ege e is lle inient with the
More informationCS 340, Fall 2016 Sep 29th Exam 1 Note: in all questions, the special symbol ɛ (epsilon) is used to indicate the empty string.
CS 340, Fll 2016 Sep 29th Exm 1 Nme: Note: in ll questions, the speil symol ɛ (epsilon) is used to indite the empty string. Question 1. [10 points] Speify regulr expression tht genertes the lnguge over
More informationIn the last lecture, we discussed how valid tokens may be specified by regular expressions.
LECTURE 5 Scnning SYNTAX ANALYSIS We know from our previous lectures tht the process of verifying the syntx of the progrm is performed in two stges: Scnning: Identifying nd verifying tokens in progrm.
More informationFig.25: the Role of LEX
The Lnguge for Specifying Lexicl Anlyzer We shll now study how to uild lexicl nlyzer from specifiction of tokens in the form of list of regulr expressions The discussion centers round the design of n existing
More informationDefinition of Regular Expression
Definition of Regulr Expression After the definition of the string nd lnguges, we re redy to descrie regulr expressions, the nottion we shll use to define the clss of lnguges known s regulr sets. Recll
More informationV = set of vertices (vertex / node) E = set of edges (v, w) (v, w in V)
Definitions G = (V, E) V = set of verties (vertex / noe) E = set of eges (v, w) (v, w in V) (v, w) orere => irete grph (igrph) (v, w) non-orere => unirete grph igrph: w is jent to v if there is n ege from
More informationCS321 Languages and Compiler Design I. Winter 2012 Lecture 5
CS321 Lnguges nd Compiler Design I Winter 2012 Lecture 5 1 FINITE AUTOMATA A non-deterministic finite utomton (NFA) consists of: An input lphet Σ, e.g. Σ =,. A set of sttes S, e.g. S = {1, 3, 5, 7, 11,
More informationDistance vector protocol
istne vetor protool Irene Finohi finohi@i.unirom.it Routing Routing protool Gol: etermine goo pth (sequene of routers) thru network from soure to Grph strtion for routing lgorithms: grph noes re routers
More informationDr. D.M. Akbar Hussain
Dr. D.M. Akr Hussin Lexicl Anlysis. Bsic Ide: Red the source code nd generte tokens, it is similr wht humns will do to red in; just tking on the input nd reking it down in pieces. Ech token is sequence
More informationContainers: Queue and List
Continers: Queue n List Queue A ontiner in whih insertion is one t one en (the til) n eletion is one t the other en (the he). Also lle FIFO (First-In, First-Out) Jori Cortell n Jori Petit Deprtment of
More informationGreedy Algorithm. Algorithm Fall Semester
Greey Algorithm Algorithm 0 Fll Semester Optimiztion prolems An optimiztion prolem is one in whih you wnt to fin, not just solution, ut the est solution A greey lgorithm sometimes works well for optimiztion
More informationthis grammar generates the following language: Because this symbol will also be used in a later step, it receives the
LR() nlysis Drwcks of LR(). Look-hed symols s eplined efore, concerning LR(), it is possile to consult the net set to determine, in the reduction sttes, for which symols it would e possile to perform reductions.
More informationMITSUBISHI ELECTRIC RESEARCH LABORATORIES Cambridge, Massachusetts. Introduction to Matroids and Applications. Srikumar Ramalingam
Cmrige, Msshusetts Introution to Mtrois n Applitions Srikumr Rmlingm MERL mm//yy Liner Alger (,0,0) (0,,0) Liner inepenene in vetors: v, v2,..., For ll non-trivil we hve s v s v n s, s2,..., s n 2v2...
More informationΕΠΛ323 - Θεωρία και Πρακτική Μεταγλωττιστών
ΕΠΛ323 - Θωρία και Πρακτική Μταγλωττιστών Lecture 3 Lexicl Anlysis Elis Athnsopoulos elisthn@cs.ucy.c.cy Recognition of Tokens if expressions nd reltionl opertors if è if then è then else è else relop
More informationLexical Analysis: Constructing a Scanner from Regular Expressions
Lexicl Anlysis: Constructing Scnner from Regulr Expressions Gol Show how to construct FA to recognize ny RE This Lecture Convert RE to n nondeterministic finite utomton (NFA) Use Thompson s construction
More informationCS143 Handout 07 Summer 2011 June 24 th, 2011 Written Set 1: Lexical Analysis
CS143 Hndout 07 Summer 2011 June 24 th, 2011 Written Set 1: Lexicl Anlysis In this first written ssignment, you'll get the chnce to ply round with the vrious constructions tht come up when doing lexicl
More informationLesson 4.4. Euler Circuits and Paths. Explore This
Lesson 4.4 Euler Ciruits nd Pths Now tht you re fmilir with some of the onepts of grphs nd the wy grphs onvey onnetions nd reltionships, it s time to egin exploring how they n e used to model mny different
More informationOutline. Motivation Background ARCH. Experiment Additional usages for Input-Depth. Regular Expression Matching DPI over Compressed HTTP
ARCH This work ws supported y: The Europen Reserh Counil, The Isreli Centers of Reserh Exellene, The Neptune Consortium, nd Ntionl Siene Foundtion wrd CNS-119748 Outline Motivtion Bkground Regulr Expression
More informationCS412/413. Introduction to Compilers Tim Teitelbaum. Lecture 4: Lexical Analyzers 28 Jan 08
CS412/413 Introduction to Compilers Tim Teitelum Lecture 4: Lexicl Anlyzers 28 Jn 08 Outline DFA stte minimiztion Lexicl nlyzers Automting lexicl nlysis Jlex lexicl nlyzer genertor CS 412/413 Spring 2008
More informationChapter 9. Greedy Technique. Copyright 2007 Pearson Addison-Wesley. All rights reserved.
Chpter 9 Greey Tehnique Copyright 2007 Person Aison-Wesley. All rights reserve. Greey Tehnique Construts solution to n optimiztion prolem piee y piee through sequene of hoies tht re: fesile lolly optiml
More informationIf you are at the university, either physically or via the VPN, you can download the chapters of this book as PDFs.
Lecture 5 Wlks, Trils, Pths nd Connectedness Reding: Some of the mteril in this lecture comes from Section 1.2 of Dieter Jungnickel (2008), Grphs, Networks nd Algorithms, 3rd edition, which is ville online
More informationCOMMON FRACTIONS. or a / b = a b. , a is called the numerator, and b is called the denominator.
COMMON FRACTIONS BASIC DEFINITIONS * A frtion is n inite ivision. or / * In the frtion is lle the numertor n is lle the enomintor. * The whole is seprte into "" equl prts n we re onsiering "" of those
More informationDuality in linear interval equations
Aville online t http://ijim.sriu..ir Int. J. Industril Mthemtis Vol. 1, No. 1 (2009) 41-45 Dulity in liner intervl equtions M. Movhedin, S. Slhshour, S. Hji Ghsemi, S. Khezerloo, M. Khezerloo, S. M. Khorsny
More informationTopic 2: Lexing and Flexing
Topic 2: Lexing nd Flexing COS 320 Compiling Techniques Princeton University Spring 2016 Lennrt Beringer 1 2 The Compiler Lexicl Anlysis Gol: rek strem of ASCII chrcters (source/input) into sequence of
More informationPattern Matching. Pattern Matching. Pattern Matching. Review of Regular Expressions
Pttern Mthing Pttern Mthing Some of these leture slides hve een dpted from: lgorithms in C, Roert Sedgewik. Gol. Generlize string serhing to inompletely speified ptterns. pplitions. Test if string or its
More informationImplementing Automata. CSc 453. Compilers and Systems Software. 4 : Lexical Analysis II. Department of Computer Science University of Arizona
Implementing utomt Sc 5 ompilers nd Systems Softwre : Lexicl nlysis II Deprtment of omputer Science University of rizon collerg@gmil.com opyright c 009 hristin ollerg NFs nd DFs cn e hrd-coded using this
More informationLexical analysis, scanners. Construction of a scanner
Lexicl nlysis scnners (NB. Pges 4-5 re for those who need to refresh their knowledge of DFAs nd NFAs. These re not presented during the lectures) Construction of scnner Tools: stte utomt nd trnsition digrms.
More informationLecture 8: Graph-theoretic problems (again)
COMP36111: Advned Algorithms I Leture 8: Grph-theoreti prolems (gin) In Prtt-Hrtmnn Room KB2.38: emil: iprtt@s.mn..uk 2017 18 Reding for this leture: Sipser: Chpter 7. A grph is pir G = (V, E), where V
More informationA matching algorithm for measuring the structural similarity between an XML document and a DTD and its applications $
Informtion Systems 29 (2004) 23 46 A mthing lgorithm for mesuring the struturl similrity etween n XML oument n DTD n its pplitions $ Elis Bertino, Giovnn Guerrini, Mro Mesiti, * Diprtimento i Informti
More informationGENG2140 Modelling and Computer Analysis for Engineers
GENG4 Moelling n Computer Anlysis or Engineers Letures 9 & : Gussin qurture Crete y Grn Romn Joles, PhD Shool o Mehnil Engineering, UWA GENG4 Content Deinition o Gussin qurture Computtion o weights n points
More informationCSCI 3130: Formal Languages and Automata Theory Lecture 12 The Chinese University of Hong Kong, Fall 2011
CSCI 3130: Forml Lnguges nd utomt Theory Lecture 12 The Chinese University of Hong Kong, Fll 2011 ndrej Bogdnov In progrmming lnguges, uilding prse trees is significnt tsk ecuse prse trees tell us the
More informationAlgorithm Design (5) Text Search
Algorithm Design (5) Text Serch Tkshi Chikym School of Engineering The University of Tokyo Text Serch Find sustring tht mtches the given key string in text dt of lrge mount Key string: chr x[m] Text Dt:
More informationWORKSHOP 9 HEX MESH USING SWEEP VECTOR
WORKSHOP 9 HEX MESH USING SWEEP VECTOR WS9-1 WS9-2 Prolem Desription This exerise involves importing urve geometry from n IGES file. The urves re use to rete other urves. From the urves trimme surfes re
More informationCOMP 423 lecture 11 Jan. 28, 2008
COMP 423 lecture 11 Jn. 28, 2008 Up to now, we hve looked t how some symols in n lphet occur more frequently thn others nd how we cn sve its y using code such tht the codewords for more frequently occuring
More informationReducing a DFA to a Minimal DFA
Lexicl Anlysis - Prt 4 Reducing DFA to Miniml DFA Input: DFA IN Assume DFA IN never gets stuck (dd ded stte if necessry) Output: DFA MIN An equivlent DFA with the minimum numer of sttes. Hrry H. Porter,
More informationLanguages. L((a (b)(c))*) = { ε,a,bc,aa,abc,bca,... } εw = wε = w. εabba = abbaε = abba. (a (b)(c)) *
Pln for Tody nd Beginning Next week Interpreter nd Compiler Structure, or Softwre Architecture Overview of Progrmming Assignments The MeggyJv compiler we will e uilding. Regulr Expressions Finite Stte
More informationΕΠΛ323 - Θεωρία και Πρακτική Μεταγλωττιστών. Lecture 3b Lexical Analysis Elias Athanasopoulos
ΕΠΛ323 - Θωρία και Πρακτική Μταγλωττιστών Lecture 3 Lexicl Anlysis Elis Athnsopoulos elisthn@cs.ucy.c.cy RecogniNon of Tokens if expressions nd relnonl opertors if è if then è then else è else relop è
More informationApplied Databases. Sebastian Maneth. Lecture 13 Online Pattern Matching on Strings. University of Edinburgh - February 29th, 2016
Applied Dtses Lecture 13 Online Pttern Mtching on Strings Sestin Mneth University of Edinurgh - Ferury 29th, 2016 2 Outline 1. Nive Method 2. Automton Method 3. Knuth-Morris-Prtt Algorithm 4. Boyer-Moore
More informationFinite Automata. Lecture 4 Sections Robb T. Koether. Hampden-Sydney College. Wed, Jan 21, 2015
Finite Automt Lecture 4 Sections 3.6-3.7 Ro T. Koether Hmpden-Sydney College Wed, Jn 21, 2015 Ro T. Koether (Hmpden-Sydney College) Finite Automt Wed, Jn 21, 2015 1 / 23 1 Nondeterministic Finite Automt
More informationCSc 453. Compilers and Systems Software. 4 : Lexical Analysis II. Department of Computer Science University of Arizona
CSc 453 Compilers nd Systems Softwre 4 : Lexicl Anlysis II Deprtment of Computer Science University of Arizon collerg@gmil.com Copyright c 2009 Christin Collerg Implementing Automt NFAs nd DFAs cn e hrd-coded
More informationSection 2.3 Functions. Definition: Let A and B be sets. A function (mapping, map) f from A to B, denoted f :A B, is a subset of A B such that
Setion 2.3 Funtions Definition: Let n e sets. funtion (mpping, mp) f from to, enote f :, is suset of suh tht x[x y[y < x, y > f ]] n [< x, y 1 > f < x, y 2 > f ] y 1 = y 2 Note: f ssoites with eh x in
More informationDeterministic. Finite Automata. And Regular Languages. Fall 2018 Costas Busch - RPI 1
Deterministic Finite Automt And Regulr Lnguges Fll 2018 Costs Busch - RPI 1 Deterministic Finite Automton (DFA) Input Tpe String Finite Automton Output Accept or Reject Fll 2018 Costs Busch - RPI 2 Trnsition
More informationLexical Analysis. Amitabha Sanyal. (www.cse.iitb.ac.in/ as) Department of Computer Science and Engineering, Indian Institute of Technology, Bombay
Lexicl Anlysis Amith Snyl (www.cse.iit.c.in/ s) Deprtment of Computer Science nd Engineering, Indin Institute of Technology, Bomy Septemer 27 College of Engineering, Pune Lexicl Anlysis: 2/6 Recp The input
More information5 ANGLES AND POLYGONS
5 GLES POLYGOS urling rige looks like onventionl rige when it is extene. However, it urls up to form n otgon to llow ots through. This Rolling rige is in Pington sin in Lonon, n urls up every Friy t miy.
More informationUTMC APPLICATION NOTE UT1553B BCRT TO INTERFACE PSEUDO-DUAL-PORT RAM ARCHITECTURE INTRODUCTION ARBITRATION DETAILS DESIGN SELECTIONS
UTMC APPLICATION NOTE UT1553B BCRT TO 80186 INTERFACE INTRODUCTION The UTMC UT1553B BCRT is monolithi CMOS integrte iruit tht provies omprehensive Bus Controller n Remote Terminl funtions for MIL-STD-
More informationIntroduction to Algebra
INTRODUCTORY ALGEBRA Mini-Leture 1.1 Introdution to Alger Evlute lgeri expressions y sustitution. Trnslte phrses to lgeri expressions. 1. Evlute the expressions when =, =, nd = 6. ) d) 5 10. Trnslte eh
More informationCompilers. Topic 4. The Symbol Table and Block Structure PART II. Mick O Donnell: Alfonso Ortega:
Compilers Topi 4 The ol Tle nd Blok Struture PART II Mik O Donnell: mihel.odonnell@um.es Alfonso Orteg: lfonso.orteg@um.es Topi 2: Blok Struture 2 1 ol tles with lok strutures Blok Struture Progrmming
More informationTO REGULAR EXPRESSIONS
Suject :- Computer Science Course Nme :- Theory Of Computtion DA TO REGULAR EXPRESSIONS Report Sumitted y:- Ajy Singh Meen 07000505 jysmeen@cse.iit.c.in BASIC DEINITIONS DA:- A finite stte mchine where
More information6.045J/18.400J: Automata, Computability and Complexity. Quiz 2: Solutions. Please write your name in the upper corner of each page.
6045J/18400J: Automt, Computbility nd Complexity Mrh 30, 2005 Quiz 2: Solutions Prof Nny Lynh Vinod Vikuntnthn Plese write your nme in the upper orner of eh pge Problem Sore 1 2 3 4 5 6 Totl Q2-1 Problem
More informationCS 432 Fall Mike Lam, Professor a (bc)* Regular Expressions and Finite Automata
CS 432 Fll 2017 Mike Lm, Professor (c)* Regulr Expressions nd Finite Automt Compiltion Current focus "Bck end" Source code Tokens Syntx tree Mchine code chr dt[20]; int min() { flot x = 42.0; return 7;
More informationScanner Termination. Multi Character Lookahead. to its physical end. Most parsers require an end of file token. Lex and Jlex automatically create an
Scnner Termintion A scnner reds input chrcters nd prtitions them into tokens. Wht hppens when the end of the input file is reched? It my be useful to crete n Eof pseudo-chrcter when this occurs. In Jv,
More informationMidterm Exam CSC October 2001
Midterm Exm CSC 173 23 Otoer 2001 Diretions This exm hs 8 questions, severl of whih hve suprts. Eh question indites its point vlue. The totl is 100 points. Questions 5() nd 6() re optionl; they re not
More informationClass Overview. Database Design. Database Design Process. Database Design. Introduction to Data Management CSE 414
Introution to Dt Mngement CSE 44 Unit 6: Coneptul Design E/R Digrms Integrity Constrints BCNF Introution to Dt Mngement CSE 44 E/R Digrms ( letures) CSE 44 Autumn 08 Clss Overview Dtse Design Unit : Intro
More informationGraph Contraction and Connectivity
Chpter 14 Grph Contrtion n Connetivity So fr we hve mostly overe tehniques for solving problems on grphs tht were evelope in the ontext of sequentil lgorithms. Some of them re esy to prllelize while others
More informationCS481: Bioinformatics Algorithms
CS481: Bioinformtics Algorithms Cn Alkn EA509 clkn@cs.ilkent.edu.tr http://www.cs.ilkent.edu.tr/~clkn/teching/cs481/ EXACT STRING MATCHING Fingerprint ide Assume: We cn compute fingerprint f(p) of P in
More informationError Numbers of the Standard Function Block
A.2.2 Numers of the Stndrd Funtion Blok evlution The result of the logi opertion RLO is set if n error ours while the stndrd funtion lok is eing proessed. This llows you to rnh to your own error evlution
More informationLecture 12 : Topological Spaces
Leture 12 : Topologil Spes 1 Topologil Spes Topology generlizes notion of distne nd loseness et. Definition 1.1. A topology on set X is olletion T of susets of X hving the following properties. 1. nd X
More informationIntroduction. Example
OMS0 Introution isjoint sets n minimum spnning trees In this leture we will strt by isussing t struture use for mintining isjoint subsets of some bigger set. This hs number of pplitions, inluing to mintining
More informationCICS Application Design
CICS Applition Design In orer to lern whih questions hve een nswere orretly: 1. Print these pges. 2. Answer the questions. 3. Sen this ssessment with the nswers vi:. FAX to (212) 967-3498. Or. Mil the
More informationParadigm 5. Data Structure. Suffix trees. What is a suffix tree? Suffix tree. Simple applications. Simple applications. Algorithms
Prdigm. Dt Struture Known exmples: link tble, hep, Our leture: suffix tree Will involve mortize method tht will be stressed shortly in this ourse Suffix trees Wht is suffix tree? Simple pplitions History
More informationCompilers Spring 2013 PRACTICE Midterm Exam
Compilers Spring 2013 PRACTICE Midterm Exm This is full length prctice midterm exm. If you wnt to tke it t exm pce, give yourself 7 minutes to tke the entire test. Just like the rel exm, ech question hs
More informationCMPSC 470: Compiler Construction
CMPSC 47: Compiler Construction Plese complete the following: Midterm (Type A) Nme Instruction: Mke sure you hve ll pges including this cover nd lnk pge t the end. Answer ech question in the spce provided.
More informationParallelization Optimization of System-Level Specification
Prlleliztion Optimiztion of System-Level Speifition Luki i niel. Gjski enter for Emedded omputer Systems University of liforni Irvine, 92697, US {li, gjski} @es.ui.edu strt This pper introdues the prlleliztion
More information2 Computing all Intersections of a Set of Segments Line Segment Intersection
15-451/651: Design & Anlysis of Algorithms Novemer 14, 2016 Lecture #21 Sweep-Line nd Segment Intersection lst chnged: Novemer 8, 2017 1 Preliminries The sweep-line prdigm is very powerful lgorithmic design
More informationGraphs with at most two trees in a forest building process
Grphs with t most two trees in forest uilding process rxiv:802.0533v [mth.co] 4 Fe 208 Steve Butler Mis Hmnk Mrie Hrdt Astrct Given grph, we cn form spnning forest y first sorting the edges in some order,
More informationSolids. Solids. Curriculum Ready.
Curriulum Rey www.mthletis.om This ooklet is ll out ientifying, rwing n mesuring solis n prisms. SOM CUES The Som Cue ws invente y Dnish sientist who went y the nme of Piet Hein. It is simple 3 # 3 #
More informationTyping with Weird Keyboards Notes
Typing with Weird Keyords Notes Ykov Berchenko-Kogn August 25, 2012 Astrct Consider lnguge with n lphet consisting of just four letters,,,, nd. There is spelling rule tht sys tht whenever you see n next
More informationGraph theory Route problems
Bhelors thesis Grph theory Route prolems Author: Aolphe Nikwigize Dte: 986 - -5 Sujet: Mthemtis Level: First level (Bhelor) Course oe: MAE Astrt In this thesis we will review some route prolems whih re
More informationCOMPUTER EDUCATION TECHNIQUES, INC. (WEBLOGIC_SVR_ADM ) SA:
In orer to lern whih questions hve een nswere orretly: 1. Print these pges. 2. Answer the questions. 3. Sen this ssessment with the nswers vi:. FAX to (212) 967-3498. Or. Mil the nswers to the following
More informationSome necessary and sufficient conditions for two variable orthogonal designs in order 44
University of Wollongong Reserch Online Fculty of Informtics - Ppers (Archive) Fculty of Engineering n Informtion Sciences 1998 Some necessry n sufficient conitions for two vrile orthogonl esigns in orer
More informationA decision support system prototype for fuzzy multiple objective optimization
EUSFLAT - LFA A eision support system prototype for fuzzy multiple ojetive optimiztion Fengjie Wu Jie Lu n Gungqun Zhng Fulty of Informtion Tehnology University of Tehnology Syney Austrli E-mil: {fengjiewjieluzhngg}@it.uts.eu.u
More informationAsurveyofpractical algorithms for suffix tree construction in external memory
Asurveyofprtil lgorithms for suffix tree onstrution in externl memory M. Brsky,, U. Stege n A. Thomo University of Vitori, PO Box, STN CSC Vitori, BC, VW P, Cn SUMMAY The onstrution of suffix trees in
More informationInternet Routing. Reminder: Routing. CPSC Network Programming
PS 360 - Network Progrmming Internet Routing Mihele Weigle eprtment of omputer Siene lemson University mweigle@s.lemson.eu pril, 00 http://www.s.lemson.eu/~mweigle/ourses/ps360 Reminer: Routing Internet
More informationWhat are suffix trees?
Suffix Trees 1 Wht re suffix trees? Allow lgorithm designers to store very lrge mount of informtion out strings while still keeping within liner spce Allow users to serch for new strings in the originl
More informationBayesian Networks: Directed Markov Properties (Cont d) and Markov Equivalent DAGs
Byesin Networks: Direte Mrkov Properties (Cont ) n Mrkov Equivlent DAGs Huizhen Yu jney.yu@s.helsinki.fi Dept. Computer Siene, Univ. of Helsinki Proilisti Moels, Spring, 2010 Huizhen Yu (U.H.) Byesin Networks:
More informationTries. Yufei Tao KAIST. April 9, Y. Tao, April 9, 2013 Tries
Tries Yufei To KAIST April 9, 2013 Y. To, April 9, 2013 Tries In this lecture, we will discuss the following exct mtching prolem on strings. Prolem Let S e set of strings, ech of which hs unique integer
More informationECE 468/573 Midterm 1 September 28, 2012
ECE 468/573 Midterm 1 September 28, 2012 Nme:! Purdue emil:! Plese sign the following: I ffirm tht the nswers given on this test re mine nd mine lone. I did not receive help from ny person or mteril (other
More informationLR Parsing, Part 2. Constructing Parse Tables. Need to Automatically Construct LR Parse Tables: Action and GOTO Table
TDDD55 Compilers nd Interpreters TDDB44 Compiler Construction LR Prsing, Prt 2 Constructing Prse Tles Prse tle construction Grmmr conflict hndling Ctegories of LR Grmmrs nd Prsers Peter Fritzson, Christoph
More informationProblem Final Exam Set 2 Solutions
CSE 5 5 Algoritms nd nd Progrms Prolem Finl Exm Set Solutions Jontn Turner Exm - //05 0/8/0. (5 points) Suppose you re implementing grp lgoritm tt uses ep s one of its primry dt strutures. Te lgoritm does
More informationAdvanced Programming Handout 5. Enter Okasaki. Persistent vs. Ephemeral. Functional Queues. Simple Example. Persistent vs.
Avne Progrmming Hnout 5 Purel Funtionl Dt Strutures: A Cse Stu in Funtionl Progrmming Persistent vs. Ephemerl An ephemerl t struture is one for whih onl one version is ville t time: fter n upte opertion,
More informationOutline. CS38 Introduction to Algorithms. Graphs. Graphs. Graphs. Graph traversals
Outline CS38 Introution to Algorithms Leture 2 April 3, 2014 grph trversls (BFS, DFS) onnetivity topologil sort strongly onnete omponents heps n hepsort greey lgorithms April 3, 2014 CS38 Leture 2 2 Grphs
More informationQuiz2 45mins. Personal Number: Problem 1. (20pts) Here is an Table of Perl Regular Ex
Long Quiz2 45mins Nme: Personl Numer: Prolem. (20pts) Here is n Tle of Perl Regulr Ex Chrcter Description. single chrcter \s whitespce chrcter (spce, t, newline) \S non-whitespce chrcter \d digit (0-9)
More informationFinal Exam Review F 06 M 236 Be sure to look over all of your tests, as well as over the activities you did in the activity book
inl xm Review 06 M 236 e sure to loo over ll of your tests, s well s over the tivities you did in the tivity oo 1 1. ind the mesures of the numered ngles nd justify your wor. Line j is prllel to line.
More informationGenerating Editors for Direct Manipulation of Diagrams
Generting Eitors for Diret Mnipultion of Digrms Gerhr Viehstet n Mrk Mins Lehrstuhl für Progrmmiersprhen Universität Erlngen-Nürnerg Mrtensstr. 3, 91058 Erlngen, Germny E-mil: fviehste,minsg@informtik.uni-erlngen.e
More informationCOMBINATORIAL PATTERN MATCHING
COMBINATORIAL PATTERN MATCHING Genomic Repets Exmple of repets: ATGGTCTAGGTCCTAGTGGTC Motivtion to find them: Genomic rerrngements re often ssocited with repets Trce evolutionry secrets Mny tumors re chrcterized
More informationHash-based Subgraph Query Processing Method for Graph-structured XML Documents
Hsh-bse Subgrph Query Proessing Metho for Grph-struture XML Douments Hongzhi Wng Hrbin Institute of Teh. wngzh@hit.eu.n Jinzhong Li Hrbin Institute of Teh. lijzh@hit.eu.n Jizhou Luo Hrbin Institute of
More informationCS 340, Fall 2014 Dec 11 th /13 th Final Exam Note: in all questions, the special symbol ɛ (epsilon) is used to indicate the empty string.
CS 340, Fll 2014 Dec 11 th /13 th Finl Exm Nme: Note: in ll questions, the specil symol ɛ (epsilon) is used to indicte the empty string. Question 1. [5 points] Consider the following regulr expression;
More informationMTH 146 Conics Supplement
105- Review of Conics MTH 146 Conics Supplement In this section we review conics If ou ne more detils thn re present in the notes, r through section 105 of the ook Definition: A prol is the set of points
More informationShould be done. Do Soon. Structure of a Typical Compiler. Plan for Today. Lab hours and Office hours. Quiz 1 is due tonight, was posted Tuesday night
Should e done L hours nd Office hours Sign up for the miling list t, strting to send importnt info to list http://groups.google.com/group/cs453-spring-2011 Red Ch 1 nd skim Ch 2 through 2.6, red 3.3 nd
More informationPROBLEM OF APOLLONIUS
PROBLEM OF APOLLONIUS In the Jnury 010 issue of Amerin Sientist D. Mkenzie isusses the Apollonin Gsket whih involves fining the rius of the lrgest irle whih just fits into the spe etween three tngent irles
More informationComparing Hierarchical Data in External Memory
Compring Hierrhil Dt in Externl Memory Surshn S. Chwthe Deprtment of Computer Siene University of Mryln College Prk, MD 090 hw@s.um.eu Astrt We present n externl-memory lgorithm for omputing minimum-ost
More informationChapter 16. Shortest Paths Shortest Weighted Paths
Chpter 6 Shortet Pth Given grph where ege re lle with weight (or itne) n oure vertex, wht i the hortet pth etween the oure n ome other vertex? Prolem requiring u to nwer uh querie re roly known hortet-pth
More informationExample: Source Code. Lexical Analysis. The Lexical Structure. Tokens. What do we really care here? A Sample Toy Program:
Lexicl Anlysis Red source progrm nd produce list of tokens ( liner nlysis) source progrm The lexicl structure is specified using regulr expressions Other secondry tsks: (1) get rid of white spces (e.g.,
More informationLINX MATRIX SWITCHERS FIRMWARE UPDATE INSTRUCTIONS FIRMWARE VERSION
Overview LINX MATRIX SWITCHERS FIRMWARE UPDATE INSTRUCTIONS FIRMWARE VERSION 4.4.1.0 Due to the omplex nture of this updte, plese fmilirize yourself with these instrutions nd then ontt RGB Spetrum Tehnil
More informationWidth and Bounding Box of Imprecise Points
Width nd Bounding Box of Impreise Points Vhideh Keikh Mrten Löffler Ali Mohdes Zhed Rhmti Astrt In this pper we study the following prolem: we re given set L = {l 1,..., l n } of prllel line segments,
More informationEvaluating Regular Expression Matching Engines on Network and General Purpose Processors
Evluting Regulr Expression Mthing Engines on Network n Generl Purpose Proessors Mihel Behi Wshington University Computer Siene n Engineering St. Louis, MO 63130-4899 mehi@se.wustl.eu Chrlie Wisemn Wshington
More informationCSc 453 Compilers and Systems Software. 6 : Top-Down Parsing I
C 45 Compilers n ystems oftwre 6 : op-down Prsing I Christin Collberg Deprtment of Computer iene University of rizon ollberg@gmil.om Copyright 2009 Christin Collberg eptember 14, 2009 1 Overview 2 Compiler
More informationCS 430 Spring Mike Lam, Professor. Parsing
CS 430 Spring 2015 Mike Lm, Professor Prsing Syntx Anlysis We cn now formlly descrie lnguge's syntx Using regulr expressions nd BNF grmmrs How does tht help us? Syntx Anlysis We cn now formlly descrie
More informationPrinciples of Programming Languages
Principles of Progrmming Lnguges h"p://www.di.unipi.it/~ndre/did2c/plp- 14/ Prof. Andre Corrdini Deprtment of Computer Science, Pis Lesson 5! Gener;on of Lexicl Anlyzers Creting Lexicl Anlyzer with Lex
More information