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

August 9th - Codegen is (tentatively) done!

 
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: Wed Aug 09, 2006 10:24 pm    Post subject: August 9th - Codegen is (tentatively) done! Reply with quote

Mmmmkay, I think I've got the codegen to where I'd like it before moving on. What's left is picky stuff that can mostly be worried about at a later date; basically right now the compiler will make valid code, but it's not guaranteed to be as optimal as possible.

I got three of the four things done that I wanted to. That is, I made '!' invert jumps (easy); I made array constructors work properly (pretty easy); and I fixed the temp reg bug (tedious). I didn't work on optimizing the op= yet. But like I said before, I can work on that later. The code it makes for op= right now is suboptimal but functional.

So what I'm left with for the compiler:

  • Work on fixing assignment conflicts. That means this is a known bug. What happens is something like this:
    Code:
    local a, b;
    a[b], a = foo();
    Since assignment values are copied to the destinations from right-to-left, 'a' will be overwritten before 'a[b]' is written to, which is 99? of the time not what the programmer intended to happen. Lua solves this; I know what I need to do, it's just going to be really tricky.
  • Improve op=, as mentioned above.
  • Make it possible to compile Unicode source code, just like D. I mostly don't feel like fiddling with Unicode translation right now.
  • Change the concat instruction (and the codegen for it) to be like Lua - that is, it concatenates a range of values rather than two at a time. The MiniD spec mentions this, so it's got to be done.
  • Generate debug line info. Fairly minor, but might be kind of a pain since the line info is kept somewhat distantly from the internals of the codegen.
  • Implement tail calls. These are really easy to do in the codegen (in the return statement, see if there's one return and if it's a call, make it a tailcall), but are somewhat tricky to implement in the VM. They're a great addition though.


I've started outlining the VM and State classes. The VM does the actual interpreting, and the State is just the current state of the MiniD environment. It's also where the user will access the API.

It's kind of overwhelming to think "yes! I've finished the compiler!" and then realize that I've still got the VM, API, and standard library to go. But it's almost intoxicating to know that with just a little more work, I'll be able to make it go.
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