Home | About | Partners | Contact Us

SourceForge Logo

Quick Links
Home
News
Status
Building XL
XL Mailing List

Understanding XL
Conceptual overview
XL examples
Inside XL

In depth
Browse SVN
Browse CVS (deprecated)
SourceForge Info
Contact

Other projects
GNU Project
The Mozart Project

XLR: Extensible Language and Runtime

The art of turning ideas into code

XL, an extensible programming language, implements the ideas of Concept Programming.
If you want to know more, you should start here.

Multiple runtimes

Friday, July 6, 2007

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.

July 2007
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
Jun  Aug


Copyright 2007 Christophe de Dinechin (Blog)
E-mail: XL Mailing List (polluted by spam, unfortunately)