Cs 433-assignment - lexical analysis construction complete


Assignment - Lexical Analysis Construction

Overview - Over the rest of the semester, you will implement a compiler for the Tiger programming language. Tiger, developed by Prof. Andrew Appel, is a traditional imperative-style programming language, with a syntax similar to that of the ML family (though it lacks advanced features such as polymorphic type inference and first-class functions).

The language is described in Prof. Appel's series of texts, Modern Compiler Implementation in Java (1st Ed.), Modern Compiler Implementation in C, and Modern Compiler Implementation in ML. A short yet fairly complete guide to the language has been written by Prof. Stephen Edwards (see "Reading", above).

In this assignment, you will complete a JFlex specification of the lexical analysis for Tiger. To get you started, a skeleton distribution and supporting files are available (attached).

Your Job - Complete the lexical specification of Tiger, as begun in the skeleton Tiger.flex file. The keywords and operators in the language are given in the reference document, and you will need to make sure that you have implemented recognition of all of them. In addition, pay attention to the following:

Within string literals, escape sequences should be properly translated into their meanings.

Be sure that unclosed comments and unclosed strings are detected at the end of file. Remember that comments can be nested.

Be sure that all unclosed strings are detected at the end of a line, unless the \ ... \ line continuation form is used.

Note that all integers are positive. This means, for example, that -5 should be detected as two separate tokens.

Reading -

Mogensen, Ch. 2, for the background on why a tool like JFlex works in the first place.

User manual for JFlex (available from the main page for this site): pay particular attention to section 3 ("A simple example").

Stephen Edwards, Tiger Language Reference Manual (link), to get a sense of the source language and knowledge of the keywords and constants your lexer will need to recognize.

Andrew Appel, Modern Compiler Implementation in Java (1st ed.) (Appendix A), for another presentation of the Tiger language.

Attachment:- Assignment.rar

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Cs 433-assignment - lexical analysis construction complete
Reference No:- TGS02646356

Expected delivery within 24 Hours