Node:Introduction, Previous:Top, Up:Top
This document contains the specification of the X Language developers.
This document describes the X Language program, a new multi-syntax programming including a portable set of APIs to create console or graphical applications runnable on many platforms (UNIX/X11, Win32, ...). X Language comes with an interpreter, a compiler and a debugger.
Copyright © 2001 Patrick Deschenes
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by Patrick Deschenes.
Usage
xlang [OPTIONS]... [FILES]...
Short option | Long option | Description
|
-h | -help | Print help and exit
|
-V | -version | Print version and exit
|
-j | -jit | Turn ON the JIT compiler
|
-d | -debug | Turn ON the debugger
|
-p
| ||
-build-package
| ||
Build a package
|
C-like language is a language similar to C used in the X Language development framework. There is some big difference with ANSI C like memory and array management but the syntax is similar enough to be learned in a couple of minutes by a C programmer. This chapter describes the C-like language specifications.
void main (string args[]) { io_write ("Hello the world\n"); }
Basic type | Description | Example
|
void | Nothing | .
|
bool | Boolean type (32-bits) | true, false
|
pointer | Pointer type (32-bits) | null
|
char | 8-bits signed integer | -128, 127
|
uchar | 8-bits unsigned integer | 0, 255
|
short | 16-bits signed integer | -32767, 32768
|
ushort | 16-bits unsigned integer | 0, 65535
|
int | 32-bits signed integer | -2147483647, 2147483648
|
uint | 32-bits unsigned integer | 0, 4294967294
|
float | 32-bits floating point number | -10.5, 10.5
|
double | 64-bits floating point number | -10.5, 10.5
|
string | Text string | "text\n"
|
Syntax
line-terminator: CR LF input-character: Anything but CR or LF input-characters: input-character input-characters input-character any-character: Anything any-characters: any-character any-characters any-character comment: comment-classic comment-endline comment-classic: /* any-characters */ comment-endline: // input-characters line-terminator
Examples
// Comments until the carriage return /* Any characters until the next */
The general syntax of an identifier is the following :
Syntax
letter: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z digit: 0 1 2 3 4 5 6 7 8 9 first-character: letter _ : identifier-character: letter digit _ : identifier-characters: identifier-character identifier-characters identifier-character identifier: first-character identifier-charactersopt
Examples
myfnct myfnct2 _myfnct my::fnct
bool | char | class | const
|
double | else | false | float
|
for | if | import | inherit
|
int | new | null | pointer
|
return | short | static | string
|
true | uchar | uint | ushort
|
void | while
|
Syntax
bool-literal: true false
Examples
true false
Syntax
digit: one of 0 1 2 3 4 5 6 7 8 9 digits: digit digits digit integer-literal: digits
Examples
0 100 234
Syntax
float-literal: digits . digits
Examples
0.5 1.5 1000.25
Syntax
character: single-character escape-character characters: character characters character single-character: anything except ' and \ escape-character: \r \n \t \" character-literal: ' character '
Examples
'A' '\n' 'x' '0'
Syntax
string-literal: " characters "
Examples
"Hello" "Hello the world\n" "\tChapter\n"
Syntax
null-literal: null
Examples
null
[ ] | ( ) | < | >
|
<= | >= | != | ==
|
! | & | | | ~
|
&& | || | << | >>
|
, | . | ; | +
|
- | * | / | %
|
^ | ++ | - | +=
|
-= | *= | /= | %=
|
<<= | >>= | &= | |=
|
^=
|