I've written lots and lots of scripting languages (compiled to byte-code and executed on a stack-based VM) in the past and wanted to do something a bit different this time.
Lua's tables interested me greatly. So I've been working on a language that borrows a little from this concept, but hopefully introduces some interesting concepts.
I've written a parser that can build an abstract syntax tree for syntax like the following:
[source]
[10,a=3,(a){ b=a; }][c.method[3]];
main=(args)
{
f=[4,func=(x){ x=10; },9];
g=f.func();
};
[/source]
Looks like gibberish, I know, but the basic idea is that any entity, including constants, are basically lists and can be subscripted with indices, subscripted with method names as string literals or have their members accessed via member name with a . operator.
The main interesting feature I'm going for is that an actual function, declared with the (){ /* ... */ } syntax, is just a value like any other and can be assigned to a variable. Internally, a function is just a list of parameter names and a list of statements, which can obviously contain other functions.
[EDIT - after I posted, realised going to have to rethink that syntax as an expression could start with an opening parenthesis. May have to accept a function keyword to start the declaration instead.]
I'm thinking that the VM is going to create and maintain reference-counted list of actual list instances. So even just a literal decimal will still be created as a list with one item in it. Not to sure how this is going to work really.
Variables will be dynamically typed and basically just references to list instances. Lists will be able to contain other lists and so on and the VM instruction set will be heavily geared up to making list access as efficient as possible.
Huge numbers of potential issues ahead, I'm sure, but its a fun project. Probably not going to have much time to work on it as real life comes crashing back in.
----------------------------------------------
Got a month's sobriety behind me on Saturday and appear to have achieved my dream job out of nowhere. Funny how this stuff works. Not too sure how much I can say about it at the moment out of professional etiquette but I'm pretty excited in my own way.
----------------------------------------------
So being an Outstanding Forum Member didn't last long then
