Assignment 1
Assignment 1
Assignment 1
Lexer & Recognizer
2 Submission 3
3 Plagiarism 3
1
Assignment 1
version 1.0
1 Specification
In this assignment, you are required to write a lexer and a recognizer for a program written
in MC. To complete this assignment, you need to:
• Set up the environment
– Make sure that java can run on your machine otherwise JAVA JDK must
be installed (https://www.oracle.com/technetwork/java/javase/downloads/jdk8-
downloads-2133151.html )
– Download and install python 3 from https://www.python.org/
– Download file antlr-4.7.2-complete.jar from https://www.antlr.org/download.html
(the link below "Complete ANTLR-4.7.2 Java binaries jar").
– Set an environment variable named AN T LR_JAR keep the path to the file
antlr-4.7.2-complete.jar.
– Follow the instructions in Section Python Targets of https://www.antlr.org/download.html
to install/have antlr4-python3-runtime.
– Download assignment1.zip, unzip it and follow the instructions in initial/README.txt
to test your environment.
2
2 Submission
In this assignment, you are required to submit three files MC.g4, LexerSuite.py and Parser-
Suite.py. Note that you must submit 3 files, NOT compress them.
You can assume that there is at most one error in each test case.
The deadline of both phases of assignment 1 is announced in the class website.
3 Plagiarism
You must complete the assignment by yourself and do not let your work seen by someone
else, otherwise, you will be punished by the university rule for plagiarism.