FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

August 4th - happy happy happy

 
Post new topic   Reply to topic     Forum Index -> MiniD
View previous topic :: View next topic  
Author Message
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Fri Aug 04, 2006 7:39 pm    Post subject: August 4th - happy happy happy Reply with quote

I ran this through the compiler:

Code:
local a, b, c;

if(a < 10 || b < 10 || c < 10)
   print("hi");
else
   print("bye");


and got:

Code:
Function at simple.md(1:1)
        Local a(at simple.md(1:7), reg 0)
        Local b(at simple.md(1:10), reg 1)
        Local c(at simple.md(1:13), reg 2)
        Const 0: 10
        Const 1: "print"
        Const 2: "hi"
        Const 3: "bye"
        [0] cmp r0, c0
        [1] jlt 5
        [2] cmp r1, c0
        [3] jlt 3
        [4] cmp r2, c0
        [5] jge 5
        [6] getg r3, c1
        [7] lc r4, c2
        [8] call r3, 2, 0
        [9] jmp 4
        [10] getg r3, c1
        [11] lc r4, c3
        [12] call r3, 2, 0
        [13] ret r0, 1


joy joy joy joy joy! It works!

It's not done, but I am so happy it works.
Back to top
View user's profile Send private message
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Fri Aug 04, 2006 9:45 pm    Post subject: Reply with quote

Tweaked the codegen some more. Realized that jump offsets should be -1 since the PC is incremented right after the instruction fetch. Also, the register allocation / expression stack are working better than I expected - I only ran into a few small problems so far. I'll be working on getting more ambitious code to compile tomorrow.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> MiniD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group