Node:X Language classes, Next:ABI, Previous:Directory structure, Up:Top
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.