XL stands for "Extensible Language". It's a programming language designed to address the challenges faced by programmers today. It addresses these challenges not by adding language features, but by making it easy and safe for any programmer to add features themselves.
To illustrate its flexibility, XL currently exists in two main dialects:
Both languages share the same syntax and meta-programming model.
Some of the key objectives for XL are:
The last objective is so important that it gives its name to the language. The philosophy is to build as much as possible using a very small number of rules. The rationale behind this approach is that what we can do, programmers can do. In other words, if it's easy to add a basic construct such as if-then-else to the language, it will also be easy to add more advanced constructs such as tasking or support for SIMD computations.
To achieve these objectives, XL is built around a few key ideas:
WriteLn "Hello World"
Hello World in XL2
XL2 is the imperative flavor of XL. It is intended to feel familiar to programmers who used languages such as C, C++, Pascal or Ada.
XL2 offers the following features:
'X' * 2
Simple plug-in in XL2
XL2 is based on XL, so it also offers advanced innovative meta-programming capabilities:
Support for object-oriented programming in XL2 is currently relatively weak. ↩
0! -> 1
N! -> N * (N-1)!
Factorial in XLR
XLR is the functional variant of XL. It is intended to feel familiar to programmers who used languages such as Lisp, Scheme, Haskell, and to a certain extent Python or Ruby.
XLR has the following standard features:
if true then X else Y -> do X
if false then X else Y -> do Y
Adding "If-then-else" in XLR
XLR is based on XL, so it also offers advanced meta-programming capabilities:
Attached is the current draft of the XLR language reference. This is work in progress.
A major update of this document has been posted here for review in January, 2012, and should be updated on a regular basis. It describes not the state of XLR as it is currently implemented, but where we are trying to go.
Here are some of the major changes in this draft:
The "context", which is currently a C++ class (two, actually, "Context" for -O0 and -O3, and "Symbols" for -O1) referencing a few other classes (notably "Rewrite"), is now defined entirely in terms of XLR nodes. I intend to modify the XLR compiler so that all symbol management can be done entirely with XLR data structures.
The document finally contains a description of the XLR type system. Types identify shapes of trees, and they can do pretty fancy stuff. I still need to see if I can make this compatible with the type inference we have, which is critical to performance.