Results 1 to 5 of 5

Thread: If Parser

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Hello pstudio, thanks for your reply, your idea is very good, my language already supports if etc and many data types, whiles, fors, repeats, pretty much everything of a modern language, however for my purpose it kind of defeats the point of the language. In your example variables would need to be changed or at the least memory would be used to create a temporary storage for doing the comparison, the idea really is to allow the programmer to know and understand exactly what his code will produce at the same time making it easier to write.

    In theory this idea is pretty good but the registers would be changed without the programmer knowing defeating the point and would produce alot of extra code

    all of the following:
    Code:
    r0 := edx = 1      // edx == 1
    are still cmp's.

    so imagine

    //al as r0
    al = (edx = 1);

    Code:
    cmp edx, 1
    setz al
    setz instruction basically does the following: set al if the compare is equal


    Overall the overhead of a few small jne/je/jnc/jc etc is worth it over memory operations.


    My current if parser is just a forward generator, a brute force recursive procedure. Thanks again for your interest and input. I hope to hear some more good ideas

    just to show what i look for exactly... my code can handle complex if/while/for statements already so:

    Code:
    if ((eax != 1) and ((ecx == 2) or ((edx == 3) and (edi == 0))) and (ebx =< 22) and (esi == 12)) {
    	ShowMessageA('Sample', 'Hello World!');
    }
    this already is assembled into machine code correct, which is equivalent to:

    Code:
      		cmp	eax,00000001h
      		jz 	L00403041
      		cmp	ecx,00000002h
      		jz 	L00403028
      		cmp	edx,00000003h
      		jnz	L00403041
      		cmp	edi,00000000h
      		jnz	L00403041
     L00403028:
      		cmp	ebx,00000016h
      		ja 	L00403041
      		cmp	esi,0000000Ch
      		jnz	L00403041
      		push	_Hello_World_
      		push	_Sample_
      		call	SUB_L004030A6
     L00403041:
    so that is works is not a problem, but i just would like to see the different ideas on how they believe it should be done, and if someone comes up with an idea that will be faster/better for optimization that would be superb
    Last edited by Colin; 10-03-2013 at 02:38 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
  •