|
|
|
|
Quick Links
Understanding XL
In depth
Other projects
|
XLR: Extensible Language and Runtime
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
XL, an extensible programming language, implements the ideas of Concept Programming.
If you want to know more, you should start here.
Starting with Revision 316, the XL compiler supports multiple runtimes. What I call a "runtime" in that context is an execution environment. As of today, "multiple" means 2. One has to start somewhere. What this means is that you can now compile the same program two different ways. If you use nxl julia.xl, you compile it with the runtime called default, which is currently using C. If you use nxl -r Java julia.xl, you use a runtime called Java, which uses the Java programming language. There were minor changes to the language for that purpose. In particular, the declaration of C functions does not work for the Java runtime, obviously. So on a C runtime, you can declare:
function sin(X : real) return real is C.sin In Java, you would declare the same function as:
function sin(X : real) return real is Java."Math.sin" Notice the change in syntax to accomodate extended names. The textual form is to remind you that the "." in "Math.sin" is not the XL ".". In C++, if I ever implement it, you would write:
function sin(X : real) return real is CXX."std::sin" As a consequence of this change, I moved the most fundamental functions to the XL bytecode, so that the declaration remains the same in all cases, e.g. someting like:
function sin(X : real) return real is XL.BYTECODE.sin_real Using Java proved troublesome: Java is not a good low-level target language for a number of reasons, not the least being that there is no goto statement. Normally, a compiler transforms an if statement into a conditional goto. I hacked my way around, but I'll see if I can find a way that is more "structured" than the present approach. Another issue was finding ways to make sure that all variables were declared and initializd, knowing that Java uses two different syntaxen for objects and basic types (ugh). In short, within the first day of implementing this Java runtime, I had hit two of the reasons I don't like Java: its dogmatic nature (goto is bad, no goto), its dogmatic nature (basic single-inheritance objects are the one true way, so that's all there is for you). It is not clear that the Java runtime will ever allow more than basic "Hello world" style programs in XL. At some point, I will have to implement a non-imperative runtime. I will probably use XL to generate LaTeX or HTML or something like that, but I still need to find some really useful context to do so.
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Copyright 2007 Christophe de Dinechin (Blog)
E-mail: XL Mailing List (polluted by spam, unfortunately)