Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Project 3a: MiniJava Front End

Description

With the experience of the first two projects behind us, we should be able to build the front end of our MiniJava compiler. In this first part of the project, we will build a lexer, parser, and abstract syntax tree for MiniJava.

The lexer should be mostly the one from the first project that returns appropriate token types for each terminal in the language. CUP will generate the symbol constants for you this time, so you will need to replace your constants with the ones from the parser.

The parser should encode the grammar rules of MiniJava as specified in the appendix/website.

The semantic actions of the parser should construct an AST. The AST nodes are defined for you by the   textbook author and a Zipfile of necessary Java files are provided as a download from the class website.

You must use the provided AST node objects without modification as we are going to use the author’s PrettyPrintVisitor.java file to pretty print your AST as validation that your lexer and parser are working appropriately.

 

Requirements

•    Use JFlex to implement a  MiniJava lexer that returns symbols to the parser

•    Use JavaCUP to implement a parser and construct an AST

•    Use the provided PrettyPrintVisitor to correctly pretty print your AST back into MiniJava

•    For this project, you may assume valid MiniJava programs. Your next project will focus on finding and reporting lexing, parsing, and type checking errors.

 

Submission

By the deadline, you need to submit:

1.   Your JFlex file containing your lexer

2.   Your JavaCUP file containing your parser

3.   Your java files containing main() and any auxiliary Java files you have used

4.   A Makefile to build it all

5.   A README text file describing how to run it

6.   Any (and at least 2) examples that you created and have tested your program on Upload the files to D2L by the deadline.