Results 1 to 5 of 5

Thread: If Parser

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    If Parser

    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
    Last edited by Colin; 08-03-2013 at 05:33 PM.
    Download the Ziron Assembler
    Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •