Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Generates a matrix table and a lexical analyzer in C + + which can analyze the following lexemes ( One code per lexeme ) Feedback

Generates a matrix table and a lexical analyzer in C++ which can analyze the following lexemes (One code per lexeme)
Feedback Acknowledgment:
// Comment
/* Another comment */
Numbers in scientific notation:
1.08e17
1.299898e-4
You can base it on the following code:
sing namespace std;
#include
//We define the transition matrix
//0-9 of the other
int m_Int[2][3]={{1,200,200},
{1,100,200}};
// Function to remove the column from the matrix that corresponds to the character
int getCol(char c)
{ switch (c)
{ case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9': return 0; // numbers 0 to 9, column 0
case '':
case '\0': return 1; // delimiters: space or end of string
default: return 2; // column "other"
}
}
int main()
{// We read the string that we are going to evaluate
char string[100];
cout << "Enter the string to evaluate: ";
cin >> string;
cout << string << endl;
int i =0;
char aux; // aux will be each character of the string
int state =0; // We start in state 0
int column =0;
while (state !=100 && state !=200 && i <100)
{ aux = string[i]; // we will process characters one by one
cout << "string["<

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

More Books

Students also viewed these Databases questions

Question

What is a walk-through, and why is this procedure used in an audit?

Answered: 1 week ago

Question

Explain the importance of Human Resource Management

Answered: 1 week ago

Question

Discuss the scope of Human Resource Management

Answered: 1 week ago