0% found this document useful (0 votes)
24 views6 pages

CD Assignment

Compiler Design CSE

Uploaded by

mohamed.niyaz219
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
24 views6 pages

CD Assignment

Compiler Design CSE

Uploaded by

mohamed.niyaz219
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
LEXICAL ANALY SIC o [kis he fivst- phase @ the Lampilet also known as Scammot. + Lexical cmnalyset generator js Called Lex ROLE OF THE LEXICAL ANALYZER + Ac “the firsh phase othe compiles the main teak oy the fevicat amatyzen 1s to read “he wpuk Chavacton oy te Source cade. o And thon group “thom Into oxen and produce output a» Sequence 4, -tokdna “fr each loxema in the Soure we . o Next te Stream 2- tokens Is Sent to “the parser for - Syntax omettysis - © (hon lextoal cual 2021 dicgowrs lexome constituents. On identifier tt noods to @cler that bexeme Into S¢mbol table. = Commonly, “ta intertaction 1s Tmpemented by having. fie “parser called Leditat aunty ger. Syptere tree > Joxicat_ |] 8" _, 5 ( Bae) > Yanatysn Power | 4 / senmamtic. <~qetNettToken |__| “Anatiyers (% oa wbo! Table. fq: Interactions between ‘Ihe bexiaat cmelyy2o77 emel the parser. e The cal sugested by tho getNexHoken Commend Couns “the Loxeal anole Yo react Character from The input ont. ale ‘dontfies “tha nat lexeme Oma produce. for the wut Jokon void. He vetuxns “the pout. once “the Fenat malar ws the PAS af perfooms othe yanks vesicles Jdontificateo" Oy fexomer . 1 One weh tasks 1s Stapp Whitespace - omer Nemaies gprvrated 2. Anotvon task Vs correlating, by the Compiler wrth iu. Sourta. lode . qe Comypilen put cowrmandls ond [eww] ON X= Abb +e l o Resmi & simple procores Thal cy wet vequite Solouigattion ye fea) . mpd Sud ow cletetten <] commands, compaction g consecutive yohiteoptee Chataten wit one - LenacaL ANALYSIS + * Levtoat dumber” propwr 1s he rare comaplex portion . Which prods -fokans From tno Output ay “The Sooner. teoxtial analysts Vs pers. ° Swplicity % Dengh- © Compilor efyiel © Enhanced Compiler portabillige Lex TooL « Langage 4or Specipgng lexieat analysers - Fevtont. © Lex \s a) lextcat curly 707 Yeo! mostly wreck wrth C Yace parse generator) Lavical analyzer genbreter. lox-fea| > 6 a Lexie aMaly Z071 genoutor. LEX Couxte-pregram Jor) | ——+| fox compilers J——> Fee IS levyyc | ——+[C compiles |—~ a. cuk Snput Stream J qouk | Sequente “holiais Processiner A LEX PROGRAM. eepatr An wpe ple desoribes Me, Joxost, amvaty7" to be. gests nawned tax.) ie Ussitten ia jox Language - exer? + Ta c compilen tesmpile: We He Hie into an wreute pile. coed [Link]. tile aout take a Shean put and proce 4 Stream of fevers grea ¢ The outpr Character STRUCTURE OF LEX PROERAM) * Wo lox progrom consis & Teen, sechionn Separated by a line. °Jo */o jor % deprition . Section! ( declaration ) oh fo #% Ruler eection (freanglation wiles) To Lo * auriliary functors yo DEFINITION SECTION . ; heado Files © Th ams we wedre declaw puncte Yncluce , . \tastiables and Cosnstamts - dele {ltin} ws § dele ™) namion { degit + (A falrgit 3+) 2CE[+- J 2g drgit fra + Hany text ic enclosed Ww pg. 3 brackets. + Anytiing ayeitten in ts brackets 8 copied div to athe -file Lox. yy-e - te dude 2 stdio-h> wnt glob _vertiavole 5 fe 3 Regular: elegwitiows bow & the forgin 4 aligit [o-4 letter [a-z A-Z Rots SECTION + « Fao We has te form pottom & attron Whee , inpab 2 ackion Must begin in tue Samo line. +r actton Is ompty the Matched foken w atscarded eh Po if { return OCIF); 3 °h &f 24" % “ho Ladvgit 34 4 printf (“numben "23y { eifen G* s pont = Csnowen) 5 Le A AUXILARY FUNCTIONS © fax qpuctadens: co code fir The maken Specified in te wulen Gehon ard place ede Ho a Single pwmton called yylor(y / + Vecloovatons +/ hh / + Rulo « / Lh int wath 0) : qlee; po) Bakewnank & ' audi} ova fumckiony . vetan (5 3 Stevecture oF CeENERATED ANALYZER) ° The preqram Wat Server: or the lexical Analy <4 | ‘Pdudes o -pikedl Poreqrom, The. SArullase an cuddowvation Tnpt babe lexeme Levene Frac} ig: Archileantre, ga fexted Avalyor | + As tho powr open Wohathan hak actowiation Is cbetevminstic and non deteuuniste | © the yet gy". fevteal Anetyzen comats Sy compenenh | Theta created from the oe program Weeth- | These components are . ® A -+eantthow Pre automation. | @® hose functions ava pared drectly Wwough vex to ths : @ We acho pow the Wwput Progra Which appeat on spragmonts ay the cote, “he be ivokest tue cppopiate fim. | by fie cutorwatiow Sivulator . @ Bb constuct dertowatey) we begin by tating eae olen expramon pater vn the lax Conmorting t uatng, “the Algorithm given to the Prguee. ® We comlorma all the NAS Wo one by Introcluctng, & now stosit’ etate witn € Hanmikon 40 cach te Stok State tho NFAs Ns for pattern. p;

You might also like