Why use strict parsing rules?
In x86 assembly language, you write a move instruction like this:
MOV EAX, 13
My emulator accepts that. But right now it also accepts:
MOV EAX 13
MOV EAX,, 13
MOV EAX,,,,,,,,, 13
In other words, I only require that I can separate the tokens in the instruction somehow.
My question to you is: other than trying to be exactly like Intel's assembly language, why be more strict? So long as the interpreter / compiler can figure out what the programmer wants, why fuss over how many commas are used?
In other words, why not parse as leniently as possible, and only complain when a situaiton is ambiguous or otherwise unresolvable?
MOV EAX, 13
My emulator accepts that. But right now it also accepts:
MOV EAX 13
MOV EAX,, 13
MOV EAX,,,,,,,,, 13
In other words, I only require that I can separate the tokens in the instruction somehow.
My question to you is: other than trying to be exactly like Intel's assembly language, why be more strict? So long as the interpreter / compiler can figure out what the programmer wants, why fuss over how many commas are used?
In other words, why not parse as leniently as possible, and only complain when a situaiton is ambiguous or otherwise unresolvable?
You could even accept MOVE.
ReplyDeleteIf this is an educational tool, I'd use strict parsing because most languages require it and I wouldn't want the students to develop habits that will bite them later.
ReplyDelete