Thursday 26 January 2012

JIT integration

Here's a fun puzzle.

Let's say that I want to integrate a JIT into WideC, which is fine and implementable for me because I have LLVM to rock with which supports JIT capabilities.

So let's say that I have an implementation that supports this. How does it look like?

Main() {
    somevalue := Standard.IO.Input.Read(int)();
    Standard.Containers.Array(float, somevalue) variable; // OK, JITs the type
}

This is all well and fine- nice and smooth.

But where does the JIT's memory go? If you don't have enforced-GC in this situation, then you can't really guarantee that the memory is cleaned up correctly. If you do, then those people who do need the performance might get flying fucked.

Maybe I'll just have to live with "less-smooth" if you want to have non-GC. Let's theorize about how this might go.

Main() {
    do_stuff = Standard.JIT.Create(function(int somevalue)() { Standard.Containers.Array(float somevalue) variable; });
    do_stuff(); // do_stuff is an RAII object like std::function
}

This might work. It might not even require being a special language feature.

Wednesday 11 January 2012

Problems

Let's get to the meat of the problems that I'm currently facing.

1. Bison blows. No, really. I'm tired of not being able to return non-POD data or pass arguments forward. In addition, I generally find it's interface poor- for example not being able to specify arbitrary ICEs as the token values is going to be the maintenance death of me next time I add a new token. In addition, the code is unreadable, and it uses unnecessary memory allocation. I figure that creating an LR parser shouldn't be so hard, and I don't see why it can't be implemented more simply.

2. The lexer could really use being predictive. :(

3. The AST needs to have a bunch of LLVM stuff in it. This is unhappy faces for me, because I want to have separate code for dealing with LLVM. I don't want to start including all the LLVM stuff in the parser header. Been thinking of PIMPL for this purpose, but man, that shit is ugly.

4. I have seriously GOT TO write a specification. I keep forgetting half my damn semantics. I need to re-host my site, and put up a specification that clearly explains everything.

Sunday 1 January 2012

So much to do

1. Change the parser so that it properly sends location information back through so the semantic analyser can give meaningful errors. Right now, only modules and some variables properly give location information. This is a source of nasty bugs because the analyser will try to access NULL pointers when trying to decide the location information to dish out to the user when someshit goes wrong.

2. Update the collater so that it can collate more than just namespaces and variables.

3. Update the lexer to be predictive instead of backtracking.

4. Work more on the website so that it contains some actual content.