21

The Lx Programming Language (2002)

 4 years ago
source link: https://www.tuicool.com/articles/yIZnmuE
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

7RVvEze.gif The LX Programming Language

Christophe de Dinechin

Version 1.9 (updated 2002/04/12 02:11:37)

What is LX?

LX is a general purpose compiled programming language, like C, C++, Pascal, Ada or Eiffel. Although LX borrowed a lot from these respected ancestors and many others, trying to incrementally improve over each of them, LX still differs from all these other languages in three important ways:

  • LX is not a closed language. It can be safely extended at various levels. Other languages can be extended at the library or pre-processor level. LX can be extended by adding compiler plug-ins.
  • As a result, LX is thebest candidate for implementing Concept Programming andMozart.
  • Thefirst LX compiler is being developed entirely under the GNU General Public License, which means that even thebase features are designed with early feedback from possible users.

A few examples of LX code (most of them won't compile as is with the compiler today):

  • The infamousHello World program
  • A simplecomplex arithmetic module
  • The generalMax and Min functions can take a variable number of arguments of any ordered type.

An Extensible Language

LX has many interestingbuilt-in features. But what makes it really special is the way you can add or change these features. In LX, almost anything can be modified, extended and adapted to suit the needs, from types (integer, arrays, pointers), to runtime behaviors (dynamic dispatch, memory management), to semantics rules (what does X.Y mean?). This extensibility gives the LX programmer seamless access to all programming paradigms out there: object-oriented, functional, declarative, aspect-oriented, etc. In addition, LX can also integrate application-specific concepts in the same convenient manner: symbolic derivative, tasking, customized optimizations, integration with other object models (COM, Corba, .NET), and more...

All this is made possible mostly thanks to an "escape mechanism" called LX pragmas. Pragmas are used to transfer control to extensions outside of the compiler, which can then perform nearly arbitrary tasks on the program being compiled. Since the pragma notation is easy to identify, the impact of well-written extensions is both easy to spot and easy to understand. LX syntax is specifically designed to be robust enough to support nearly arbitrary semantic extensions in a comfortable, readable and maintainable way. This is one reason why LX could not easily be based on any previous language. Some languages such as C++ are already so complex that trying to extend them further would bring them to a point of rupture. Others such as Lisp, have much more flexible semantics, but at the price of a rigid and unnatural syntax.

For more detail, read theWhy LX? discussion and the LX Frequently Asked Questions ...

Secondary Objectives

Additional objectives in designing a new language, besides implementing and supporting Concept Programming, included:

  • Making program maintenance easier, in particular by increasing readability
  • Enabling "programming in the large" for very large scale projects
  • Supporting optimization on modern architectures, in particular where C and C++ semantics limit them
  • Creating a language which is both easy to implement and easy to learn

For these reasons in particular, LX built-in featurescompare well with existing programming languages.

LX compared to other languages

Why use LX? Why is LX useful?

Other Frequently Asked Questions

Status of the LX compiler

Mailing list


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK