Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please provide all the code and all the files this project requires. please submit the output of the code. Code must be written in C
please provide all the code and all the files this project requires. please submit the output of the code. Code must be written in C language. If anything missing, will get down vote.
Implement scanner for the provided lexical definitions.
The scanner is embedded and thus it will return one token every time it is called. Since the parser is not available yet, we will use a tester program to call the scanner.
The scanner could be implemented as
Plain string reader read strings separated by spaces assuming
all tokens must be separated by spaces
for counting lines chars
As above but tokens do not have to be separated by WS
for counting lines chars
FSA table driver
You must have the README.txt file with your submission stating on the first line which option you are using: or and if then include information where the FSA table is and which function is the driver. If this information is missing, the project will be graded under option
Implement a token as a triplet tokenID tokenInstance, line# and char#or pair if no processing line numbers
Dont forget EOFtk token at the end
Implement the scanner in a separate file with basename "scanner"
For testing purposes, the scanner will be tested using a testing driver implemented in the the same scanner file or in a file with basename "testScanner". You need to implement your own tester and include as a part of the project. This tester will ask the scanner for one token at a time and display the token to the screen, one per line, including information descriptive on what token class, what token instance, and what line, if applicable.
This is just
while token tokenscanner eofTk
print descriptive token followed by token instance or nothing if no instance followed by line number if processing followed by
Invocation:
scanner file
to read from stdin or file file
Arguments are the same as P
Wrong invocations may not be graded
Dont confuse executable name with file name with function name
Grading rubric
points for architecturestyle regardless of implementation method
points for stdin so can handle redirected input, such as doing scanner inputfile
points for handling invocation and execution errors
remaining points for properly recognizingdisplaying tokens
You must have the following: C or Java handle similarly
types including token type in token.h
implement scanner in scanner.c and scanner.h
implement the tester in another file testScanner.c and testScanner.h or in the scanner file
main.c processing the arguments as in P then calling testScanner function with interface and preparation as needed.
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