Question: 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.

Develop a scanner that will recognize the list of keywords shown inthe following section. Use the finite state machine/table approach. The scanner shouldbe implemented as an object; the nexttoken() function should be a member

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!