Each line of MIXAL may contain 1-3 fields, a label, a command and an address (argument). All are optional ! For instance, the following are all legal lines (comments after *):
* single HLT command HLT * label, command ,argument 3H SLA 5 * command + argument CON DATA
I'd analyze this as follows:
There may be either 1, 2 or 3 tokens
- If there's 1, it's a command (illegal command name => error)
- If there are two, it's either command + argument or label + command. So, check if the first token is a legal command, if it is - assume the second option. If it isn't -> the first.
- If there are three, it's label,command,argument