A specced little language written with ruby and treetop. It has lambdas, recursion, conditionals, arrays, hashes, ranges, strings, arithmetics and some other stuff. It even has a small code import facility.
Access the current environment:
ENV; (your output may differ)
=> { :a => 3, :foo => 5 }
Given the following environment:
{ :a => 1, :b => 2, :c => 3 }
ENV['a']
=> 1
ENV['a'..'b']
=> { :a => 1, :b => 2 }
Numeric variables and literals
3;
=> 3
a = 3;
=> 3
a;
=> 3
String variables and literals
"This is a string";
=> "This is a string";
'This is a string';
=> "This is a string";
s1 = "This is a string"; s1;
=> "This is a string"
s2 = 'This is a string'; s2;
=> "This is a string"
SIZE(s1);
=> 16
SIZE("foo");
=> 3
Variables and closure applications
a = 3; foo = 5;
calc = fun(x,y) { (x + y) * a + foo };
calc(2,2);
=> 17