[ANN] Cull [Alpha]
Hoi,
I have been working on a interpreted language, with C/C++ style syntax, that has a native code (x86) JIT compiler. The language is called Cull.
Features:
C/C++ style syntax
Very strong typing at lexical scope
x86 JIT that produces code equivalanet to VC++ 7.1 in many cases
run-time intrinsics grateful to SoftWire assembler, which means it would be possible to generate code automatically for various processors on the fly.
It is by far incomplete and many things have yet to be fleshed out (they are in various states). I have rewritten this thing about 10x now so there are bits and pieces in other projects to be worked into the latest framework.
Why did I make this?
To experiment and learn about compilers. From what I have found out it is not exceedingly hard, although I use the barest minimal techniques there are and the parser could be made much faster with better algorithms.
As an experiment to eventually merge many features of Scheme into a language that is like C/C++.
To build a VM with an underlying JIT assembler.
To have both an interpreted and native code compiled language, and to choose between them.
What it will eventually do:
Run-time intrinsics that map 1:1 to the underlying architecture at the expense of simplfying certain aspect of parsing C style code.
A primitive C-style form of OO
Functions as arguments ( var x : func_ptr --> @x(1,2,3) ... }
Ability to program in x86 assembler (only when running on the JIT).
Pointers,arrays, and strings, built in. Built in regular expressions similar to Perl (but simplified).
dynamic library loading on the fly in namespaces
namespace library("MSVCRTD.DLL")
{
func ...
}
What it does not do:
The language will be object oriented to a point, but OO will be rather like C, meaning that you can define functions on structures but the this pointer must be passed manually.
object foo {
var x : int;
func foo( a : foo ) { a.x = 1; ... }
}
var a : foo;
foo~foo(a); --> a.x = 1;
This is done mostly as I aim to squeeze the object into a structure that can be easily passed to C code, and also I do not care for a very complex OO language (and also it is a lot harder to write a parser :-)
[edit]
it *does* do this, sorry
ctypes -> import a C/C++ object from a dll
ctype foo library("foo.dll")
{
var a : int;
cfunc foo( ... )
}
I have worked most of this code out although I have rewritten the thing from scratch and not all of it has migrated into the current version.
I have not yet updated my website but if you are interested it is at http://xano.sourceforge.net. The license will be LGPL or some equivalent, that it can be used for commercial projects if you want. You can also look at how I did things, but I stuck to the barest minimums as possible to keep it simple but to allow it to run fairly fast.
In any case, it might give people a toy to play with to experiment with their own ideas. I kept everything KISS so it is not hard to get into it and mess around with it. The hardest part might be understanding how I walk the tree for x86 emmission but it's really not very hard, just a bit of recursive mumbo-jumbo.
Peace->out
[edited by - PeterTarkus on May 18, 2004 12:51:11 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement