This document provides insides for X Language developers. Please, read this before hacking.
X Language is a new multi-syntax programming language wich will ease the creation of big applications. By providing a portable set of APIs, you will be able to create CLI or GUI applications runnable on UNIX/X11 and Win32. X Language come with an interpreter/compiler/debugger. For now, only the interpreter works.
The X Language package comes with many files and directories. Here is the description of the structure used :
Next sections contains details informations about each sub-directories.
The root directory contains many files usefull to developers.
The documentation directory contains developer's and user's informations. Texinfo is used to create those documents. Those guides are also generally available via HTML or PDF.
The source files directory contains all (.c & .h) C language files. Since X Language is a medium-size project, those files are divided into sub-directories :
This directory contains basic files for X Language C development :
This directory contains source files to APIs packages :
This directory contains the core X Language source files :
This directory contains all tests that must be passed prior to any releases. Tests are composed of two files : test-XX.xc (the X Language source file) and test-XX.tst (the output that must be generated). By comparing the real output to the attended output, we know if the test passed.
The most important class in X Language is probably XLExpr. Nearly everything in X Language is based on XLExpr. An expression can be of different type :
Moreover, an expression has a list of sub-expressions. This feature is only usefull to function expression (it serves as parameters). All expressions can be evaluated. For functions, that means calling the associated function. The result of this is a value : expr->ret_data.
NOTE: Nothing new here for a real programming language developer.
There is three type of function :
Built-in functions are registered in xlbuiltin.c. Here is the prototype of a built-in function :
void builtin_fnct (XLExpr* expr);
Examples of built-in functions are (+, -, *, /, class, fnct, ...). Those functions provides low-level access to the X Language environment. With them, we can create functions 'fnct', classes 'class', variables 'local & global', flow control 'if, while, ...'. Parsers uses those functions to create an expression-tree.
New built-in functions will be created to accomodate new concepts (beyound OO).
Native functions are a little more complicated. They are there to map 'C' functions. Using a special technic, X Language know how to push parameters from XLExpr to the native 'C' function pointer. It's a little hard to explain. I suggest you to read 'xlfnct.c' source file.
A user's function is a function as described by the 'fnct' built-in function. It's nothing more than a pointer to the XLExpr to be evaluated when a call is made. Parameters are transformed as local variable using parameter's description of the user's function.