Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!