LudaScript

Posted by ludamad on April 2, 2009, 2:09 p.m.

So I'm making yet another AI related thing, and I needed an AI scripting language. So I decided to make one! The implementation (using Abstract Syntax Trees) is well under way, here's some features of the language:

-Dynamic types:

Python-like here, you have stuff like:

a = [];

a = [0,2432,["lol"]];

print(a);// outputs [0.0, 2432.0, ["lol"]]

-Lazy eval:

Functions with no args can be treated like numbers, eg

def Lol(){

return a + b;

}

a = 0;

b = 1;

a += Lol;//a now holds 1

a += Lol();//same operation as above, a now holds 3

a = Lol;//a now holds the actual operation - be careful, calling a() or Lol() will now infinite loop because of the a+b code.

-'Compile' time constants

Anything with a capital letter is a constant, they are assigned like variables, with the only condition being that they have to be resolvable during 'compile' time. Constants are never scoped.

def Func(){}//Function names will typically be constants, however this is not a must - you can have non-constant function names

A = [0,0,0];

C = [1,1,1];

B = A | C;// '|' is the array concat operator, B now holds [0,0,0,1,1,1]

String = A ~ B;//'~' is the string concat operator, String now holds "[0.0, 0.0, 0.0][1.0, 1.0, 1.0]"

-Function injecting:

Not really a feature of the language per say, but the person applying the implementation of the language (which is atm in Java, because my game is in it) can easily add function objects that will be more efficient than the scripter's functions. Also, the person applying the implementation can restrict the functions the scripter can use, if for example the script controls a unit's movement, and you don't want it to do anything random (which is the case in my game).

Comments

Xxypher 15 years, 7 months ago

I see, though this makes no sense to me.

Ross 15 years, 7 months ago

FuzzyScript would have been so much better of a name, but LudaScript is alright.

Xxypher 15 years, 7 months ago

What?

Cesar 15 years, 7 months ago

I agree with FuzzyScript

Ross 15 years, 7 months ago

Quote:
What?

We had a vote on what to name it, FuzzyScript was one of the options and the one I voted for. The other two were CiriScript and LudaScript. Only serprex voted for CiriScript.

Acid 15 years, 7 months ago

At first I just looked at how the language worked and was confused as to why you wanted to make your own. But then I actually read the whole thing and understood everything.

SixWinged 15 years, 7 months ago

I read the blog and suddenly I feel dumber for not comprehending it.