CS536 Programming (JLex to write a scanner ) Solved

$30.00 $24.00

Category:

Description

5/5 – (3 votes)

For this assignment you will use JLex to write a scanner for our language, called Wumbo, a small subset of the C++ language. Features of Wumbo that are relevant to this assignment are described below. You will also write a main program (P2.java) to test your scanner. You will be graded both on the correctness of your scanner and on how thoroughly your main program tests the scanner.

Specifications

Getting started

JLex

The Wumbo Language

What the Scanner Should Do

Errors and Warnings

The Main Program

Testing

Working in Pairs

Getting Started

Skeleton files on which you should build are available through links below.

The files are:

wumbo.jlex: An example JLex specification. You will need to add to this file.

sym.java: Token definitions (this file will eventually be generated by the parser generator). Do not change this file.

ErrMsg.java: The ErrMsg class will be used to print error and warning messages. Do not change this file.

P2.java: Contains the main program that tests the scanner. You will need to add to this file.

Makefile: A Makefile that uses JLex to create a scanner, and also makes P2.class. You may want to change this file.

However, we highly recommend that you should download and use, p2.zip.

You can directly start using it without any dependency issue.

JLex

Use the on-line JLex reference manual, and/or the on-line JLex notes for information about writing a JLex specification.

If you work on a CS Dept. Linux machine, you should have no problem running JLex. You will not be able to work on the CS Dept. Windows machines.

The Language

This section defines the lexical level of the Wumbo language. At this level, we have the following language issues:

Tokens

CS536 Programming Assignment 2 /2/14, 17:41

CS536 Programming Assignment 2 2020/2/14, 17:41

CS536 Programming Assignment 2 2020/2/14, 17:41

CS536 Programming Assignment 2 2020/2/14, 17:41

CS536 Programming Assignment 2 2020/2/14, 17:41

http://pages.cs.wisc.edu/~loris/cs536/asn/p2/p2.html Page 6 of 6