Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CMSC 4 3 0 Project 1 The first project involves modifying the attached lexical analyzer and the compilation listing generator code. You need to make

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,
acanner, 1:
The following reserved words should be added:
e1se, elsif, endfold, endif, fold, 1f, left, real, right, then
Each reserved words should be a separate token. The token name should be the same as
the lexeme, but in all upper case.
Two additional logieal operators should be added. The lexeme for the first should be
and its token should be caop. The second logical operator added should be : and its token
should be NOTOP.
Five relational operators should be added. They are =,(:>:),: and . All of the
lexemes should be represented by the single token RELOP.
One additional lexeme should be added for the ADDOP token. It is binary operator - that is
the subtraction operator.
One additional lexeme should be added for the motop token. It is/ that is the division
operator.
A new token REMOP should be added for the remainder operator. Its lexeme should be .
A new token EXPOP should be added for the exponentiation operator. Its lexeme should
be .
A new token NEGop should be added for the unary minus operator. Its lexeme should be
.
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.
The definition for the identifiers should be modified so that underscores can be included,
however, no more than two consecutive underscores are permitted, but leading and
trailing underscores should not be permitted
One additional type of integer literal should be added, which are hexadecimal integers.
The begin with the + character followed by one of more decimal digits, or the letter A-F,
in either upper or lower case.
A real literal token should be added. It should begin with a sequence of zero or more
digits following by a decimal point followed by one 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 definition for the character literals should be modified so that five additional escape
characters are also allowed: '??b','??t',?'?
?',?'??b' and '??f'.
You must also modify the header file tokens in to include each the new tokens mentioned
above.
The compilation listing generator code should be modified as follows:
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

More Books

Students also viewed these Databases questions

Question

How will you allocate resources and prioritize improvements?

Answered: 1 week ago