Administrator
|
What language are you using to write your assembler?
Basically, to parse a C-instruction you need to find the '=' and the ';' so that you can split it into destination, computation, and jump parts:
comp = instruction
dest = empty string
jump = empty string
if comp has a '=':
i = index of '='
dest = comp [0..i-1]
comp = comp [i+1..]
if comp has a ';':
i = index of ';'
jump= comp [i+1..]
comp = comp [0..i-1]
--Mark
|