You are on page 1of 4
Ay MAHATMAGANDHISCHOOL, JAKARTA ‘Snap Test 2 Class xit Max Marks: 20 aa. Date: 5" November 2022 Duration 30 min ‘A.complir uses a keyword table and a symbol abl, Part o tho koyword labo Is shown bolow. + Tokens for keywords are shown in hexadocina! + Allthe keyword tokens are in the range 00 - SF Keyword Toxen : i oP : e : z * 70 INPUT ‘oureur ENOFOR, 0 st 2 3 ‘Study the following pece of code: (@) Compete the symbol able below to show Bs contants ater the lexical onalyala sage. Symbol Token Value Tye.) Counter © Varied Ts o Constant nut na Vonaone $0 os (goss [ola lelelsletalalolt [111 Cc {oy Cancel blow reprorents one bye ofthe ouput om th eseat analysts stage, (sina the heywont table and your annaer fo part (8) comploto the output (rom the Fexical asin @ {€)_ TW to of et in bo compo Amer the ayetax analysis stage, the compli genaratos object code. The equivalent code, in fesse langage, 18 shown Bolow! S10 367 Stotea keoult in Lemporary Jocation The set /Toads: vale from Eamporary Locat ion Ano fe /vachts value D (0 Namo tho nal stage in the compilation prec that follows hs code generation stage. ephmearton. seal] (8) An interpreter is executing a program. The program uses the variables 2,» © and ct ‘The program contains an exprossion that ts writen in nix frm, The interpreter converts the {oto vxpression to APN, Tne APNexpressionis: bach sdez ‘ho interproter avaluates thas RIPN oxpression using a stack. Trecurentvaueswe a=) baz ce ‘Show tho changing conten of tha stack as th intorproter evaluates th the oniry on the stack has been done for you. «4 a2 2 The allowing syntax cagrame show te syrtax of ‘® assignment staement + avanable an unsigned nteger + alener + asat + anoperator stone tenet eC )-(aae mee He -O) vvoriable —_ uneigned integer eat letter a aigit ©) operator 2099 \ (2) The folownng assignment statements ae eval, ‘Give the reason in each case. Mase e sy reason Tht Dre Howabve eeu pes HME. ms Reason Danka Boon LENS... AONE. IO. EOSIN ee went Oty, ABs nT) ces e2- Msc: Reason LW, ANUQHINNN, Hmucerentt Cres on Onty. 7 nore (®)_ Comesete me Backus-Naur Form (BNF) forthe stax dagrams shown ot the opposte page. vosave Lepae )y om 2 ante! ron swan, =e sasasgaass “ala... ane Ste teases dit

You might also like