assembly - c++ Assembler File Reading -


i working on sic/xe assembler in c++. how should go reading sic/xe code text file?

(label - opcode - operand)

copy    start   0    first   stl retadr       ldb #length  

how getline() adapt 3rd line there no "label"? (tabbed space)

you need read line @ time, , parse different components of each line. can check if line starts "whitespace" (isspace(line[0])), in case doesn't have label [assuming rule labels, of course!]

(or can, of course, parse individual characters tokens, in same way free-form compiler c/c++ compiler works, since format looks it's rather simple, it' easier read line @ time , reject whole thing suitable error if it's not "right")


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -