Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write your program in C++. In this programming project, you will get your compiler to a great start by implementing the lexical analysis phase. For

Write your program in C++. In this programming project, you will get your compiler to a great start by implementing the lexical analysis phase. For the first task of the front-end, you will develop a scanner for the Decaf 19 programming language. Your scanner will run through the source program, recognizing Decaf tokens in the order in which they are read, until end-of-file is reached. For each token, your scanner will record its attributes appropriately (this will eventually be used by other components of your compiler) so that information about each token will be properly printed. Decaf shares many similarities with C++, although not all features exactly match. Our hope is that the familiar syntax will make things easier on you, but do be aware of the differences.

For the scanner, you are only concerned with being able to recognize and categorize the valid tokens from the input. Here is a summary of the token types in Decaf. The following are keywords. They are all reserved. void int double bool string null for while if else return break Print ReadInteger ReadLine An identier is a sequence of letters, digits, and underscores, starting with a letter. Decaf is case-sensitive, e.g., if is a keyword, but IF is an identier; binky and Binky are two distinct identiers.

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

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions

Question

Decision Making in Groups Leadership in Meetings

Answered: 1 week ago