> Thanks for the suggestion! > And sometimes I have complex commands like: > MOV.rp2 R1, R11<<3 > in which .rp2 means repeat this instruction two more times (and > increase the Register number ), i.e. > MOV R1, R11<<3 > MOV R2, R12<<3 > MOV R3, R13<<3 > > And I can write something similar in ADD > ADD.s.rp3 R1, R11<<2, R21 > in which .s means signed add (if unsigned add, use .u instead), and > its can be extends to four instructions > ADD.s R1, R11<<2, R21 > ADD.s R2, R12<<2, R22 > ADD.s R3, R13<<2, R23 > ADD.s R4, R14<<2, R24 > > As you can see, the combination of all the conditions are too complex > to cover. > And it seems impossible for me to write one rule for every possible > instruction format. > Is there any suggestion?
Just like I mentioned above. Direct the parser to only recognize the syntactical aspects of the language, i.e. that: INSTRUCTION_NAME DOT MODIFIER ARGS Is a valid like (or something like that). Set the results into an intermediate representation, and then analyze them in your code. It's much easier to handle all instructions via a table. Eli --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ply-hack" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/ply-hack?hl=en -~----------~----~----~----~------~----~------~--~---
