Yesterday I decided to restart an old project called Hidra. Hidra is a very high-level programming language like Python and Ruby that I created some years ago. The project had only personal fun purpose and the code was never released. Hidra is a full object oriented language like Java but with the advantage of being dynamically typed and to have a more compact virtual machine due that fact. The virtual machine is very similar to JVM but with 5x less opcodes. The original compiler and virtual machine code was written using Java, wich reduces the performance a lot. So the idea is to recreate the virtual machine using C++ and for now I’m planning to recreate the compiler as a prototype using Python to have less code and more flexibility to change the grammar.
I spent the last 2 days recreating the virtual machine in C++ and it’s now almost fully functional, but there are a lot to be done in order to be stable. It needs also a garbage collector and debugging support. I will reserve some hours during weekends to work in the project.

The main purpose of the project now is to have a lightweight interpreter that could be used for C++ applications to embed scripts. This could be useful for description languages like Qt Declarative UI and also to create AI scripts for games. Regarding the lightweight/optimized feature, there is a devil in my shoulder telling me to replace the virtual machine to an AST interpreter, in other words start the project from scratch. Maybe I’ll do this, because it’s the simpler way and it would allow more optimizations to be done. But for now I’ll focus on features and syntax changes to consolidate the language.

Below is a Hello World example using the current Hidra syntax (unnecessarily big just to show a little more).

class HelloWorld
    var helloText;

    public static function main(args)
        new HelloWorld("Hello World!").say();

    public HelloWorld(text)
        helloText = text;

    public function say()

As you can see the current syntax is similar to JavaScript, but with a more solid object orientation. I intend to maintain the grammar as simple as possible with some small changes to get a cleaner look (maybe more python like).

I’ll send some posts to give feedback of the progress. Stay tuned!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: