OK so i've been working a little on one of my side projects and i have come to rewriting the if parser, i'm looking for ideas, suggestions and your thoughts on the best way of performing the following task:
the code must be able to output assembly code from complex if/or/and statements. (the output is pseudo since it actually outputs machine code, but for the purpose of ideas )
so imagining there is already many functions available, such as getnexttoken, getnextmathsop, etc etc...
so a sample if statement:
Code:
if (((edx == 1) or (edx == 7)) or (eax == 5) or ((eax == 10) and (ebx == 10))) {
//the code
}
should be able to output the following or similar as long as the output is correct of course:
Code:
cmp ebx, 10
jne or1
cmp eax, 10
je thecode
or1:
cmp eax, 5
je thecode
or2:
cmp edx, 1
je thecode
cmp edx, 7
jne exitif
thecode:
//the code
exitif:
//no code was executed
I have not began to write the new code since i am first looking for ideas on the best approach, hope someone can help me to make this work good. Thanks to anyone willing to help
Bookmarks