Answered step by step
Verified Expert Solution
Link Copied!

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
+5 for counting lines + chars
As above but tokens do not have to be separated by WS
+5 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: 1,2, or 3, and if 3 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 1
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 (token=scanner()!= 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 P0
Wrong invocations may not be graded
Dont confuse executable name with file name with function name
Grading rubric
10 points for architecture/style regardless of implementation method
5 points for stdin (so can handle redirected input, such as doing ./scanner < inputfile
10 points for handling invocation and execution errors
remaining points for properly recognizing/displaying 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 P0) then calling testScanner() function with interface and preparation as needed.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Watson Watson

5th Edition

0471715360, 978-0471715368

More Books

Students also viewed these Databases questions

Question

Do you currently have a team agreement?

Answered: 1 week ago

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago