Question: C program that does the following lexical analysis Takes in a file, stores into a char array (char textArray[1024]) and conducts the following lexical analysis:
C program that does the following lexical analysis
Takes in a file, stores into a char array (char textArray[1024]) and conducts the following lexical analysis:
if the word is all lowercase, print it belongs to category 1.
if the first letter is capitalized but the rest is lowercase, print it belongs to category 2.
if it's just numbers, print it belongs to category 3.
if its 'punctuation', print it belongs to category 4.
if its a cumulation of all of the above, print it belongs to category 5
ex: void main() { printf(" Twenty =%d", 19 + 1); }
void is category 1
main() is category 5
{ is category 4
printf(" is category 5
Twenty is category 2
=%d", is category 5
19 is category 3
+ is category 4
1); is category 5
} is category 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
