Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 . General This assignment involves writing a scanner for C - - . This scanner will then be used for the remaining assignments in
General
This assignment involves writing a scanner for C This scanner will then be used for the remaining
assignments in the semester project.
Required functionality
Programming requirements
Your program should implement a function gettoken that behaves as follows:
It reads input from stdin.
It discards comments and whitespace however even though comments and whitespace are
discarded, they are significant in that they signal the end of any previous token The syntax for
comments is given in Section of the G language spec.
It identifies and returns tokens based on the tokens and patterns given in Section of the G
language spec.
Your program should use the following two files:
scanner.h a header file that defines the set of tokens together with their values; and
scannerdriver.c a file containing the driver code that invokes your scanner and prints out the
results.
In subsequent assignments we will replace the driver file scannerdriver.c with a different driver, so you may
not want to put your scanner implementation in this file.
You should submit a Makefile that provides at least the following targets:
make clean:
Deletes any object files o as well as the file 'scanner'
make scanner:
Compiles all the files from scratch and creates an executable file named 'scanner'.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started