Question: I need help with a lexical analyzer (written in Java). The keywords are only if , int , void , return , else , and

I need help with a lexical analyzer (written in Java). The keywords are only if, int ,void, return, else, and while.

I need help with a lexical analyzer (written in Java). The keywords

Write a lexical analyzer which reads a C- program, strips off comments (denoted by/* comments */), and generates four symbol tablets 1. The KEYWORD table includes all keywords defined in Louden, pp.491). Each keyword is associated with an index. You may combine the special symbols into the KexWord table. You may hardcode them Kevword Else If ndex 2. The INDENTIFIER table includes all the user-defined identifiers. The table is similar to the keyword table except that it contains identifiers. Each identifier has its unique index The NUMBER table includes all integers and floats used in the program. 3. Num 60 3.75 index attribute integer float 4. The TOKEN table includes all the tokens in the order that they are generated. The table should include the following information Token Int Gcd 3.75 For the Regular Grammar for the tokens, refer to the Lexical Conventions of C- (Loudenl). The input to your program is the example in Figure 15 in the handout class index id num 5. including the comments. Your program should strip off the comments 6. The output from the program should include the program with comments stripped off. And all the tables mentioned above 7. Please do file Vo, i.e. read the data from a file and send output to a file Write a lexical analyzer which reads a C- program, strips off comments (denoted by/* comments */), and generates four symbol tablets 1. The KEYWORD table includes all keywords defined in Louden, pp.491). Each keyword is associated with an index. You may combine the special symbols into the KexWord table. You may hardcode them Kevword Else If ndex 2. The INDENTIFIER table includes all the user-defined identifiers. The table is similar to the keyword table except that it contains identifiers. Each identifier has its unique index The NUMBER table includes all integers and floats used in the program. 3. Num 60 3.75 index attribute integer float 4. The TOKEN table includes all the tokens in the order that they are generated. The table should include the following information Token Int Gcd 3.75 For the Regular Grammar for the tokens, refer to the Lexical Conventions of C- (Loudenl). The input to your program is the example in Figure 15 in the handout class index id num 5. including the comments. Your program should strip off the comments 6. The output from the program should include the program with comments stripped off. And all the tables mentioned above 7. Please do file Vo, i.e. read the data from a file and send output to a file

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!