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

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!