Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment: The first phase of compilation is called scanning or lexical analysis. This phase interprets the input program as a sequence of characters and produces

image text in transcribedimage text in transcribed

Assignment: The first phase of compilation is called scanning or lexical analysis. This phase interprets the input program as a sequence of characters and produces a sequence of tokens, which will be used by the parser. Your job is to write (in C++) a simple scanner for source code that obeys the language described below. You may assume that the input is syntactically correct. Your program simply needs to read each token and then print out what type it is, based on the following language rules: keyword if I then I else I begin l end I function I return identifier character I character identifier integer digit I digit integer real integer.integer special I I I I digit 0111213 41516171819 character alblc... IzlAlBIC... IZ More details: Case is not used to distinguish keywords or identifiers. The delimiters are space, tab, and newline The token classes that should be recognized are keyword, identifier, integer, and real Your final program must compile and run using a C++ compiler (your choice) Submitting your work Submit your code via Blackboard. Do not submit a ZIP or archive file, submit each file independently. In the past, archives etc. have been problematic

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

Step: 3

blur-text-image

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

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago