Sale!

CSC467F Assignment 1: Scanner solved

Original price was: $35.00.Current price is: $30.00. $25.50

Category:

Description

5/5 - (8 votes)

Compilers and Interpreters
In phase 1, you are required to EXLOGD OH[LFDODQDO\VHUWRVFDQ0LQL*/6/DQGLPSOHPHQWWKH³WUDFH
VFDQHU´ IXQFWLRQDOLW\ -Tn switch) of the compiler, as given LQWKHFRPSLOHU PDQSDJH WU\³make man´ LQ
the starter1 directory).
Starter Files
The starter code is available for download from the lab web page.
Source files:
x compiler467.c -The main module for the course project.
x Makefile – A Makefile for the project.
x scanner.l – The skeleton flex scanner.
x parser.y ± The skeleton bison parser.
x compiler467.man – The man page for the compiler.
x globalvars.c -The global variables.
x common.h- The global definitions.
Specifications of the Scanner
Your lexical analyzer should store appropriate information for each token identified into a tracing file,
and any error recognized into an error file. Submit all source code (not just scanner.l), plus a short
document describing how you dealt with any special problems encountered (the basic working of flex
itself does not have to be described).
Trace output
When the -Tn (trace scanner) switch is activated in the compiler, the global variable traceScaner is set
to “TRUE” (1). Trace information should be sent to the globally visible FILE * variable traceFile. At
this stage, if the input is valid no other action has to be taken other than that specified above.
Use the provided yTRACE(x) macro to output the trace. The trace should output the tokens in the same
order that they appear in the program.
Error Handling
If the scanner encounters an illegal input it should report an error. Use the yERROR(x) macro to report
any errors.
Make sure you check for corner cases such as out of bounds integers, and identifiers that exceed the
allowed length.