XL (programming language)

XL stands for English " eXtensible Language", hence " extensible programming language". XL is a programming language that was designed to support the paradigm of concept -oriented programming.

XL provides individually reconfigurable syntax and semantics. Compiler plug- ins can be used to add more features to the language. A basic set of plug-ins implemented a fairly "normal" imperative programming language. Programmers can write their own plug -ins that provide, for example, features such as the symbolic differentiation of equations are available. Then, these functions just like the built-in features.

Language

XL is defined and divided into four levels:

  • XL0 defines how an input text is transformed into a syntax tree.
  • XL1 defines a basic language with C , comparable properties.
  • XL2 defines the standard library, which includes general data types and operators.
  • XLR defines a dynamic duration for XL based on XL0.

XL has no elementary data types or keywords. All operators and data types, such as integers or the addition are defined in the standard library ( XL2 ). XL1 is portable between different execution environments. This does not apply XL2; if a particular CPU implements for example, no floating-point multiplication, the corresponding operator may be absent in the standard library, and using a floating point multiplication in the source code during compilation leads to an error.

The Hello World program looks in XL as follows:

Use XL.TEXT_IO   WriteLn "Hello World" An alternative form in a suitable style for large programs would look like this:

Import IO = XL.TEXT_IO   IO.WriteLn "Hello World" A recursive implementation of the faculty would look like this:

0! -> 1   N! -> N * ( N-1)! syntax

The syntax is defined in the XL XL0 level. The XL0 level of the compiler can be configured by a syntax description file that defines the properties such as the text representation or the precedence of operators. A basic syntax file also defines general mathematical notations, such as ' ' For addition.

The syntax tree consists of 7 types of nodes, 4 leaf node types ( integer, real, text and symbol ) and 3 internal node types ( infix, prefix and block)

  • The integer type represents an integer literal, such as 2, the # character can be used to define a different base than 10, as in # 2 101,101th A separating underscore can be used to improve readability, eg 1_000_000.
  • The real type represents a non- integer values ​​, such as 2.5. It can be used basic information and separators, as with integers, so 16 # D.6FD # E - tenth
  • The text type represents text or string. This type is usually enclosed by single or double quotation marks, ie " foo" or "bar", but the syntax file can also define other separators, including which for multi-line texts.
  • The symbol type represents names or operators. Names are sequences of alphanumeric characters beginning with a letter, such as Hello. Symbols are the consequences of non-alphanumeric characters, such as * or = / =. Symbol is case sensitive, but XL1 ignores case and underscores, so FooBar and foo_bar be regarded as equivalent.
  • Infix - node represent two linked by an insertion node as A 1 or 2 and 3 infix nodes are used in some cases to separate lines with the insertion of " new-line ".
  • Prefix nodes represent two consecutive nodes, such as write "Hello". This type is also used for postfix, such as 3! or Open?.
  • Block nodes represent a node that is enclosed by grouping symbols, such as (A) or [Index]. Indentation is represented internally by a block node.

With the preset file syntax is the following example XL0 valid, the semantics is not important:

A = B " Hello " Becomes:

Infix ( "=",        symbol ( "A"),        infix (" ",              symbol ( "B"), text ("Hello "))) Semantics of XL1

XL1 - phase is defined as a sequence of operations on the syntax tree XL0. These operations are provided by various compiler plug- ins available that are executed based on the shape of the syntax tree.

Certain constructs, translate and translation will be provided by a plug -in that allows you to write other plug -ins. The quote construct generates a syntax tree. Here is how this notation can be used to implement a plug-in called Zero Removal, the superfluous additions and multiplications eliminated with 0.

When      'X' 0    then      return X    When      'X' * 0    then      return parse_tree ( 0) A plug-in can be enabled for an entire file, either from the command line, or local in source code by exploiting the pragma notation:

X: = { d } Differentiate (sin (omega * t ) * exp ( -T/T0 )) / dT The XL1- level includes a large set of plug-ins, especially XLSemantics, which provides general abstractions available, such as subroutines, data types and variable declarations and definitions, just as well as basic structured statements, such as If - gate or grinding.

Development Status and History

The current XL is the result of a long development that began around 1992. The language was developed mainly by Christophe de Dinechin and implemented.

First of all, the XL compiler was written in C . He had reached a point at which functioned most characteristics foreseen correct, but the writing of plug-ins has been very difficult, because C itself is not extensible, so the Implementing translate- similar expressions is impossible. The syntax tree was complicated with dozens of types of nodes, since it was designed for the simultaneous support of multiple languages ​​(cross -language support ). There is a Java to Java compiler called " moka ", which uses the same infrastructure.

To exit from the complex syntax tree structure, a completely new compiler was written in 2003. The syntax tree is greatly simplified, down to the 7 XL0 node types that are now in use. With this new compiler bootstrapping started in 2004, and the total current development of the Developer Tools happening in XL. Nevertheless, the compiler still has partially incompatible XL1 support, although its potential to surpass even in some areas of C .

Descent

XL1 is influenced by a large number of other languages:

  • Ada influenced the exception handling, task management, and maintenance aspects of the infrastructure for modularizing large programs.
  • BASIC, especially the modern versions that do not require line numbers and support structured programming, and show how a programming language can be easy.
  • C was consulted as a benchmark in terms of running time and the machine side support. XL does not require a virtual machine for execution.
  • C and the Standard Template Library showed the need for good support generic types, including implicit instantiation (at the Ada it is missing).
  • Fortrans unbroken performance advantage over C and C in numerically intensive applications helped identify which language constructs would prevent useful optimizations.
  • Java showed the importance of a large, portable support library. The Java containers also showed the limits of a not based on generic programming approach. The coupling with Java code remains an interesting challenge for XL.
  • Lisps extensibility was seen as a key factor for relevance and survival to the present day. LISP was the first language, the normalized object-oriented features, although it was developed years before the birth of the idea of object orientation.
  • Prologue showed that alternative programming models are sometimes useful and highly productive. There was a lot of effort to ensure to that, as in Prolog are possible such plug-ins in XL.
  • Visual Basic syntax tree as indicated by the visual representation can be achieved. Few people edit VB forms as text. It is expected that XLs processing plug-ins also provide one day like abilities available to process the syntax tree directly.

Semantics of XLR

XLR is a dynamic language, which was originally planned as a backend for the XL1- compiler, but has since become the name for the XL runtime. XLR uses the basic syntax of XL0 together with XL1, but this behavior can be classified, whereas XL1 was designed as a rather imperative -looking language much more close to a functional language. XLR has practically only a built-in operator "->", which marks a rewrite. The letters on the left side of the operator is converted to the notation on the right side.

This mechanism is used to implement standard notation:

If true then True else False Body Body - > True Body   if false, then True else False Body Body - > False Body Web Links

  • The earlier development page
  • " Coverage on XL and Concept programming" in "The Register" ( german)
  • Web archive of 14 January 2009 of the incorporated website: Products in " byte " (English )
  • Presentation on XL and konzeptionale programming in general (English ) (PDF, 4.8 MB)
831185
de