Create a program that will read tokens written to match the following syntax and print the type and value of each token found. The statements will be found in a file that will be passed to the program via a command line argument.
Valid tokens: EVAL, VALUE, EXP, Variable (in the form of Vnn where nn ranges from 00 to 99), Constant (decimal digits), +, -, *, /, (, ), ;
Hello everyone. That's my current lab assignment, and I have to write a state machine to do it. I've found simple examples of simple state machines on the web, but it has too many switch statements. I've also seen examples of 2-dimensional state machine and hierarchical state machine.
I still can't structure my state machine for it to do what I need to do for this lab, mainly because I'm still confused about the whole concept of State and Event. Do I make each Token a State and each character and number an Event?
State machines are supposed to make things simpler, but every way I've tried to solve the problem it seems that state machines are just as complicated as a nested switch/if statement.