Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Develop a scanner that will recognize the list of keywords shown in the following section. Use the finite state machine/table approach. The scanner should be

Develop a scanner that will recognize the list of keywords shown in the following section. Use the finite state machine/table approach. The scanner should be implemented as an object; the nexttoken() function should be a member function; the table should be a private data structure within the object. Each time the nexttoken() function is called, it should return the next token in the input stream; when no more text remains in the input stream, it should return an EOF indicator. Your scanner should skip space characters (tab, space, and newline). Write a test program to call the nexttoken(). It should accept input from STDIN, and output to STDOUT, and continue until the scanner function returns an EOF. The test program should output a text label for each token recognized in the input stream, one token per line.

image text in transcribedimage text in transcribedimage text in transcribed

Scanner is NOT case sensitive.

\begin{tabular}{|c|c|} \hline; & SEMICOLOR \\ \hline, & COMMA \\ \hline 1 & LPAREN \\ \hline 1 & RPAREN \\ \hline[ & LBRACKET \\ \hline 1 & RBRACKET \\ \hline\{ & LBRACE \\ \hline} & RBRACE \\ \hline( & LCOMMENT \\ \hline) & RCOMMENT \\ \hline \end{tabular}

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

Databases Theory And Applications 27th Australasian Database Conference Adc 20 Sydney Nsw September 28 29 20 Proceedings Lncs 9877

Authors: Muhammad Aamir Cheema ,Wenjie Zhang ,Lijun Chang

1st Edition

3319469215, 978-3319469218

More Books

Students also viewed these Databases questions

Question

Make effective use of recognition to motivate others.

Answered: 1 week ago