Freitag, 20. Juli 2007

And something else - more thoughts on Little's purpose ...

I forgot to mention the idea I had in the first instance. Little should become a fast application scripting/extension language, or better: the purpose of the VM was to serve as object-oriented application scripting engine, fast, and as customizable as possible.
As such, the VM itself provides only very basic capabilities of bytecode execution - there is not even a garbage collection system, because the VM doesn't assume by default, that dynamic memory is used at all. It is very well possible to embed it in a way, that it has to deal with typed handles to host-application-internal data only, and never allocates memory itself.

Btw, the current Little VM implementation is named 'ALICE' (A Little Intermediate Code Evaluator) - if I refer to the VM in the future, I'll call it that way. :)

ALICE is built to support a class-based flavour of object orientation, and as such has a very small set of built-in 'classes' ... which by default dangle around with more or less no relations to each other, and no invokable methods either. All of this has to be defined by an application which wants to use ALICE - here belong properties like the ability of creating instances as well as the information, that class 'Class' is an instance of 'Class'.
ALICE itself is just a DSO, plus some headers providing the API.

The entry point to customize ALICE, is, to provide a DSO libalice_boot.so, which must define the function
int alice_setup(ltl_threadenv_t *threadenv)

This function has to take care of triggering all necessary setup tasks. In the case of LITTLE, alice_boot() makes sure, external definitions for all ALICE builtin classes are loaded (the class load mechanism is part of ALICE itself), and finally loads the class alice.Bootstrap, which takes over control as soon, as it's initializer method (a mechanism similar to Java class initializers) is invoked.
alice.Bootstrap only defines methods, which allow itself to dispatch the boot process to the main LITTLE runtime system: in the first instance this is a method to provide DSO load capabilities 'loadLib'.

The LITTLE runtime then provides the rest: a 'real' class hierarchy, dynamic memory allocation, garbage collector and stuff.

Montag, 9. Juli 2007

I've just uploaded V0.7.9.7d.

Visit http://www.thalion-graphics.de/little to download.

It contains more macro system stuff - the old macro code has now finally disappeared,
and with it there go several oddities of the half-hearted solution.

Unfortunately, I can't claim that macro authoring is a strait-forward task at this point.
The API wrapping the compiler internals is not yet completed, so you still here and there
have to immediately use things like the SExpr class (which is particularly ugly, because
it's name denotes the complete absence of LISP knowlege that plagues me ... SExpr has not
really to do anything with LISP s-expressions).
On the other hand, you can now do cool things like using the plain LITTLE inline doc syntax
for macros as well.

To give you an impression of the nastiness of LITTLE macros, here is a sample (taken of the LITTLE system libraries):


(macro when
(doc
"Macro when"
"Syntax:"
" (using little.lang.macro.when)"
" (when ...)"
"This macro expands to the expression '(if (prog ...) nil)'"
"The list of expressions is executed, if is true")
(if ((CC):ge 2)
(let ((expr1 (N))
(expr2 (X 'prog)))
(C expr2)
(R (X (S 'if) expr1 expr2 (S 'nil))))
(E "expected: ' ...'")))


This one already takes use of the doc feature - most lines are inline doc.
Here is a sample of using the macro, taken from little_rep.ltl:


(when (ex:match ((clazz:getsym):tostring))
((little.io.TextOutputStream:out):println "Class <" clazz ">"c))

Sonntag, 8. Juli 2007

Why LITTLE

Ah well, this stuff is written in kinda Pigean English ... this is all I can.
I hope you can bear it, dear visitor, and have some fun while reading.
Anyway, be welcome!

In the beginning there are two questions:


Why another obscure programming language?
Why a blog for an obscure programming language, which nobody knows, and nobody cares about?

Well, maybe I can't give reasonable answers on either questions.

But I can tell of the personal motivation which made me create both language and blog anyway. ;)

LITTLE is a toy project - one of unnumbered such projects around the world, driven by pure interest, curiosity and enthusiasm of many many authors. Complete operating systems have been created that way.
So I'm in good company.

It started as experiment - I wanted to understand, how multiple inheritance can be implemented within an interpreted language, and more important, how it can be done efficiently. First of all, I wanted to find out, if _I_ can implement it.

I deliberately wanted to reinvent the wheel - possibly without looking at other wheels to much. I did not want to reimplement strategies of others - I wanted to find my own algorithms, no matter if they were especially naive or cunning. From time to time I find it interesting to see whether I still can come up with some plan that works. ;)

The project was in contemplate-about-it state for a long time, before I actually launched it and wrote the first bits of a VM and a LITTLE compiler for it. Surprisingly fast, I had a first functional version ... and suddenly loads of ideas for further enhancements.
Rather quickly development advanced - I wrote a basic class hierarchy, IO libraries and stuff, and not too much later, a LITTLE compiler written in LITTLE itself (okay, it took me a while, but this is now several years in the past, and thus the duration I recall shrinked a bit).
I added a just-in-time compiler targetting my now obsolete favourite platform SGI Irix on MIPS CPUs, and some basic graphics stuff (GL bindings, a bit of Motif).

Now, there it is.
I don't put much effort in it lately. There are other time-consuming interests of me, too ... and unfortunately I somehow have to earn some money too.
But I decided to revive it a bit - at least, to keep it alive.

So, this blog had to be born.

I will post ideas, announcement, bugfixes, sample code and whatever I feel to post about LITTLE here, whenever I feel to post it. You're welcome to read and comment ... or leave and do something better. ;)

Your sincerely,
Helmut S. aka thalion