w3future.com

Loell

lazy object evaluation little language

Last Update

10/16/2005; 1:22:40 AM

Try XHTML 2.0
Src XHTML 2.0
RDF Metadata


Site Colors

Syn Atom 1.0
Syn RSS 0.91
Syn Subscribe

CC Licensed
Geo URL
With Radio

Loell is an experimental programming language in development. The idea is to have a small core with a lot of power. For the rest I plan to use it to try out new language ideas, which I usually get from Lambda the Ultimate. The focus is on testing out language features that improve productivity, like goal directed programming, helpful typing features, readability and building abstractions.

Try some code:

Core syntax

exprs separator expr
First evaluates exprs and if that does not return failure then returns expr. Valid expression separators are ; and a new line, if the indentation on the new line is not bigger than the indentation of the line of the start of the expression.
expr.(exprs)
expr.(exprs) = expr
Gets/sets a property.
{ exprs }
Creates a closure, the current scope is stored in the scope property.
expr # closure
Evaluate a closure, using expr as scope.
expr < exprs >
Creates a new object, using expr as prototype (stored in the proto property). The current scope is stored in the scope property. If expr is ommited, Any is used. exprs is evaluated in the current scope, but with current set the newly created object.
expr closure expr
Simulates a method call. (object method argument) The closure is called with the scope it was defined in, but with this set to the left value, and that set to the right value.
expr ident= expr
A method call, where the object is set to the result.
$
The current scope.
ident
ident = expr
Gets/sets a property of the current scope
[ exprs ]
Creates a list, with for each expression an element with the value of that expression.

Shortcut syntax

expr.ident
expr.ident = expr
Gets/sets a property.
.ident
.ident = expr
.(exprs)
.(exprs) = expr
Gets/sets a property of this inside a closure definition, or of the current inside an object definition.
{ \ident separator exprs }
Creates a closure. The value of that is assigned to ident. (This makes ident the argument name for methods) The identifier may be extended to a test expression.
ident
Proper identifier tokens are: /[A-Za-z_][A-Za-z0-9_]*/, ==, != or any combination of * + - & ^ ? | /
/*...*/ //...
Javascript style comments are supported

All objects

These methods are defined:

== !=
test if it is (not) the same object
isA
test if the argument is a prototype of this object
then
Evaluates the argument if this is not failure. Use a closure if you want short-circuiting. (similar to && in Javascript)
else
Evaluates the argument if this is failure. Use a closure if you want short-circuiting. (similar to || in Javascript)

Lists

These methods are defined:

+
list concatenation
item n
Get the nth item from the list.
all closure
Returns a new list by calling closure once for every item, passing each item as the argument to closure. The result of closure is used as the given item in the new list. If a call fails, all fails.
some closure
Returns a new list by calling closure once for every item, passing each item as the argument to closure. The result of closure is used as the given item in the new list, if the call succeeds. some can be used to filter a list.

Closures

These methods are defined:

closureA | closureB
Creates a new closure, that first calls closureA, then calls closureB if that fails.

Strings

The syntax is equivalent to javascript. These methods are defined:

+
string concatenation
== !=
test for (in)equality

Numbers

The syntax is equivalent to javascript. These methods are defined:

+ - * /
arithmetic
lt gt
less than and greater than tests
== !=
test for (in)equality

Booleans

Loell has basic goal directed programming support. True is success and false is failure. Most test methods return failure when the test failes, and this when the test succeeds.

! expr
not. Turns failure into success, and anything else into failure.