CMSC 430 Project 1 The first project involves modifying the attached lexical analyzer and the compilation listing generator code. You need to make the following modifications to the lexical...

1 answer below »
must provide everything in the rubric. Including TEST CASES, DISCUSSION OF APPROACH AND LESSONS LEARNED


CMSC 430 Project 1 The first project involves modifying the attached lexical analyzer and the compilation listing generator code. You need to make the following modifications to the lexical analyzer, scanner.l: 1. A new token ARROW should be added for the two character punctuation symbol =>. 2. The following reserved words should be added: case, else, endcase, endif, if, others, real, then, when Each reserved words should be a separate token. The token name should be the same as the lexeme, but in all upper case. 3. Two additional logical operators should be added. The lexeme for the first should be or and its token should be OROP. The second logical operator added should be not and its token should be NOTOP. 4. Five relational operators should be added. They are =, /=, >, >= and <=. all="" of="" the="" lexemes="" should="" be="" represented="" by="" the="" single="" token="" relop.="" 5.="" one="" additional="" lexeme="" should="" be="" added="" for="" the="" addop="" token.="" it="" is="" binary="" -.="" 6.="" one="" additional="" lexeme="" should="" be="" added="" for="" the="" mulop="" token.="" it="" is/.="" 7.="" a="" new="" token="" remop="" should="" be="" added="" for="" the="" remainder="" operator.="" its="" lexeme="" should="" be="" rem.="" 8.="" a="" new="" token="" expop="" should="" be="" added="" for="" the="" exponentiation="" operator.="" its="" lexeme="" should="" be="" **.="" 9.="" a="" second="" type="" of="" comment="" should="" be="" added="" that="" begins="" with="" and="" ends="" with="" the="" end="" of="" line.="" as="" with="" the="" existing="" comment,="" no="" token="" should="" be="" returned.="" 10.="" the="" definition="" for="" the="" identifiers="" should="" be="" modified="" so="" that="" underscores="" can="" be="" included,="" however,="" consecutive="" underscores,="" leading="" and="" trailing="" underscores="" should="" not="" be="" permitted.="" 11.="" a="" real="" literal="" token="" should="" be="" added.="" it="" should="" begin="" with="" a="" sequence="" of="" one="" or="" more="" digits="" following="" by="" a="" decimal="" point="" followed="" by="" zero="" or="" more="" additional="" digits.="" it="" may="" optionally="" end="" with="" an="" exponent.="" if="" present,="" the="" exponent="" should="" begin="" with="" an="" e="" or="" e,="" followed="" by="" an="" optional="" plus="" or="" minus="" sign="" followed="" by="" one="" or="" more="" digits.="" the="" token="" should="" be="" named="" real_literal.="" 12.="" a="" boolean="" literal="" token="" should="" be="" added.="" it="" should="" have="" two="" lexemes,="" which="" are="" true="" and="" false.="" the="" token="" should="" be="" named="" bool_literal.="" you="" must="" also="" modify="" the="" header="" file="" tokens.h="" to="" include="" each="" the="" new="" tokens="" mentioned="" above.="" the="" compilation="" listing="" generator="" code="" should="" be="" modified="" as="" follows:="" 1.="" the="" lastline="" function="" should="" be="" modified="" to="" compute="" the="" total="" number="" of="" errors.="" if="" any="" errors="" occurred="" the="" number="" of="" lexical,="" syntactic="" and="" semantic="" errors="" should="" be="" displayed.="" if="" no="" errors="" occurred,="" it="" should="" display="" compiled="" successfully.="" it="" should="" return="" the="" total="" number="" of="" errors.="" 2.="" the="" appenderror="" function="" should="" be="" modified="" to="" count="" the="" number="" of="" lexical,="" syntactic="" and="" semantic="" errors.="" the="" error="" message="" passed="" to="" it="" should="" be="" added="" to="" a="" queue="" of="" messages="" that="" occurred="" on="" that="" line.="" 3.="" the="" displayerrors="" function="" should="" be="" modified="" to="" display="" all="" the="" error="" messages="" that="" have="" occurred="" on="" the="" previous="" line="" and="" then="" clear="" the="" queue="" of="" messages.="" an="" example="" of="" the="" output="" of="" a="" program="" with="" no="" lexical="" errors="" is="" shown="" below:="" 1="" program="" with="" no="" errors="" 2="" 3="" function="" test1="" returns="" boolean;="" 4="" begin="" 5="" 7="" +="" 2=""> 6 and 8 = 5 * (7 - 4); 6 end; Compiled Successfully Here is the required output for a program that contains more than one lexical error on the same line: 1 -- Function with two lexical errors 2 3 function test2 returns integer; 4 begin 5 7 $ 2 ^ (2 + 4); Lexical Error, Invalid Character $ Lexical Error, Invalid Character ^ 6 end; Lexical Errors 2 Syntax Errors 0 Semantic Errors 0 You are to submit two files. 1. The first is a .zip file that contains all the source code for the project. The .zip file should contain the flex input file, which should be a .l file, all .cc and .h files and a makefile that builds the project. 2. The second is a Word document (PDF or RTF is also acceptable) that contains the documentation for the project, which should include the following: a. A discussion of how you approached the project b. A test plan that includes test cases that you have created indicating what aspects of the program each one is testing and a screen shot of your compiler run on that test case c. A discussion of lessons learned from the project and any improvements that could be made Criteria Functionslity Test Pan Documentation Total 160 points Defines new comment exeme (15) Correctly modes dentiir definition to include underscores (15) ‘Adds res and Boolean tokens (15) Defines adeitonal logical operators (15) Defines sceitonsl relations aperstors (15) Defines sdeitonsl arithmetic operstors (15) Defines sditonsl reserved words and arrow symbol as) ‘Adds new tokens to the token header fl 15) Implements modifications to display mulple errors on the same fine (20) Implements modifications to count and display each type of compilation eror (20) 30 points Includes test case containing all kxemes (10) Includes test case with multiple errors on one in (10) Includes test case with no errors 10) 35 paints Discussion of approach included (10) Lessons learned included (15) Comment blocks with student name, project, de and code description included in exch fie (10) oes not Mest. fm points 1160 ‘Does not define new comment lexeme 0) ‘Does not correctly mocify identifier definition to include underscores (0) ‘Doss not add real and Boolean tokens 0) ‘Does not define ational logical operators (0) ‘Does not cefine actions! relations| operators (0) ‘Does not cefine actions! arithmetic operators (0) ‘Does not cefine actions! reserved wards snd straw symbol (0) ‘Does not add new tokens to the token header file 0) ‘Does not implement modifications to display multiple errors on the same line 0) ‘Does not Implement modifications to count and display. cach type of compilation error (0) points 30 ‘Does not include test case containing all lexemes 0) ‘Does not include test case with multiple rors on an tine (0) ‘Does not include tet case with no erors (0) points sas Discussion of approach not included (0) Lessons learned not included (0) Comment blocks with student name, project, de snd code description not included in each file (0) 1225
Answered 12 days AfterMar 26, 2023

Answer To: CMSC 430 Project 1 The first project involves modifying the attached lexical analyzer and the...

Aditi answered on Mar 27 2023
37 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here