Small project

Everything that is not related to TA3D (no abuse will be accepted) / Tout ce qui n'a rien à voir avec TA3D (aucun abus ne sera toléré)
Post Reply
User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Small project

Post by zuzuf » Sun Oct 17, 2010 1:43 pm

Recently I 'didn't have much time to work on TA3D because I've been busy, then sick and I spent the little spare time I had on another project. I've always been dreaming of creating my own programming language :mrgreen: so this is what I've been doing. It's written using bisonc++, it's compiler to byte code which is then interpreted by a virtual machine like Lua does except it's a C++-like language. Polymorphism and templates are still missing but I plan to add them. It doesn't use a Garbage Collector so you need to manage memory yourself. Even though it's interpreted it's quite fast (faster than official Lua VM and faster than LuaJIT 2 interpreter which is written in assembler but of course it's slower than LuaJIT's JIT and slower than native machine code in general by a factor 4-10 on what I've tested so far) and very modular: it builds modules which can share symbols (functions only, you don't access external variables). You can also use native modules (plugins built as shared objects, .so on Linux, .dll on windows) whose symbols are resolved dynamically like with byte code modules (and have priority over byte code for performance reasons). The VM works on 32 and 64bits Linux PC platforms and should be portable to other little-endian platforms too but I haven't tested on any big endian system and since the VM does very low level things I am not sure it works without any modification on big endian systems.

Ho and you probably want to know the name of this language :wink: : ZZF 8) , Z was already used according to Wikipedia so I took 2 U from my nick :P but it may change later.

Of course it's free software and you'll find the sources here:
svn://www.zuzuf.net/zzf
=>;-D Penguin Powered

User avatar
Balthazar
Moderator
Posts: 2055
Joined: Wed Nov 01, 2006 4:31 pm
Location: Russian Federation
Contact:

Re: Small project

Post by Balthazar » Sun Oct 17, 2010 4:01 pm

Glad to hear ) Doing great as always ) It`s sad that my knowlege of programming don`t allow me to understand it fully :P

milipili
Posts: 545
Joined: Thu Nov 02, 2006 8:52 am
Location: Paris (France)
Contact:

Re: Small project

Post by milipili » Mon Oct 18, 2010 7:53 pm

Hum sounds interesting to me (for Yuni actually :lol: ). Ok first question : is it possible to embed the engine for evaluating small expressions with unknown symbols ? (like a SQL query for example)

User case : I have thousand of objects. I would like to find all objects matching a criteria, for example where the following expression is true "flying == true && distance(0.42, 3.27, x, y) < 42" where all variables might be properties of a single object. By the way you may have the same issue in TA3D.

A few thoughts : do not stick with the C++ syntax. This is a nightmare for parsers. Properties (delphi style not C# style) are good for a programmers too ^^.

Where performances matter : could you produce a comparison chart between ZZF and other interpreted languages
Damien Gerard
Ta3d & Yuni Developer

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Re: Small project

Post by zuzuf » Mon Oct 18, 2010 8:37 pm

I'll produce some performance charts as soon as I am satisfied with the byte code ordering (I am still tuning it a bit and adding stuffs as needed). Also I am not sticking to C++ syntax which is really difficult to parse, for example you call constructors using the following syntax:

Code: Select all

class V
{
     int my_stuffs;
     V::V(int a, int b, int c);
};

V my_object:(a, b, c);

V my_function()
{
    return V:(a,b,c);
}
I had to do this to work around some bisonc++ limitations. Ho and you can't put function definition inside the class { } stuffs :P. There are also a few built-in functions (mainly standard math functions + length(x, y, z) which can be useful if you're working with vectors), a properly optimized switch :) (it uses a special byte code which reads a tree of dense tables which guaranties O(1) look ups if your values aren't sparse). Something really great with the VM is the small overhead of function calls (both from ZZF code and C code) since it's only a C function call + a few local variables to initialize (no dynamic symbol resolution, everything is static unless you really want to work with symbol names but it's slower of course).

Currently it doesn't support evaluating expressions with unknown symbols, I am counting on templates to implement this so you won't be able to make queries to the environment (it's not like Lua where everything is dynamic) since it doesn't keep track of objects but you'll be able to maintain a set of objects and implement it yourself. I am still working on the template + polymorphism design, I'd like to find a way to implement virtual templates (which should be possible if the VM can use the compiler to instantiate missing things at runtime).
=>;-D Penguin Powered

milipili
Posts: 545
Joined: Thu Nov 02, 2006 8:52 am
Location: Paris (France)
Contact:

Re: Small project

Post by milipili » Tue Oct 19, 2010 6:59 am

In this case, you should look for type inference, not templates :)
Damien Gerard
Ta3d & Yuni Developer

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests