For a gentle introduction, see 5D Tutorial.
The Source Code Character Set is supposed to be UTF-8.
The first 128 characters are used for the following:
Code | Usage |
---|---|
NUL | Has no meaning |
SOH, STX, ETX, EOT | Have no meaning |
ENQ, ACK, BEL, BS | Have no meaning |
TAB | Significant Whitespace |
LF | Newline, used for indentation tracking |
VT | Has no meaning |
FF | Has no meaning |
CR | Ignored (!!!) |
SO, SI, DLE, DC1 | Have no meaning |
DC2, DC3, DC4 | Have no meaning |
NAK, SYN, ETB | Have no meaning |
CAN, EM, SUB | Have no meaning |
ESC | Has no meaning |
FS, GS, RS, US | Have no meaning |
space | Significant Whitespace |
! | Part of identifiers |
" | Marks literal Str |
# | Special literal values |
$ | Operator |
% | Operator |
& | Operator |
' | Marks quoted expression |
( | Grouping |
) | Grouping |
* | Operator |
+ | Operator |
, | Operator |
- | Operator |
. | Operator or part of a floating-point number |
/ | Operator |
0..9 | Part of numbers or (identifiers starting from the second place) |
: | Operator |
; | Operator |
< | Operator |
= | Operator |
> | Operator |
? | Part of identifiers |
@ | Keywords |
A..Z | Part of identifiers |
[ | List macro |
\ | Abstraction |
] | List macro |
^ | Operator |
_ | Operator |
` | Operator ? |
a..z | Part of identifiers |
{ | Literal Sets, Dictionaries |
| | Operator |
} | Literal Sets, Dictionaries |
~ | Operator |
DEL | Has no meaning |
frobnicate μ mayTheForceBeWithYou42 σ ελεκτρων + ** ⋅
5 (-3) 5.23232245322151 358888888888888888888888888888888888888888888888888888888888888888888888888888 #xFF => 255 #o777 => 511 #\A => 65 -- the character code of A
In order to access modules, use the requireModule function.
Note that this automatically ensures that the module isn't loaded twice.
Result is the module. By convention, you can check for exports by using the expression:
(requireModule "IO").exports
You can load and call procedures of shared libraries:
Example:
let FFI := requireModule "FFI" in let requireSharedLibrary := FFI.requireSharedLibrary in let puts! := FFI.requireSharedLibrary "/lib/x86_64-linux-gnu/libc.so.6" 'Cip "puts" in puts! "Hello world"
What this does is:
- load the library with the given file name.
- give a procedure signature (usually as a Symbol).
- give the name of the procedure to load (usually as a Str).
- result is a callable.
The procedure signature is a Symbol whose str consists of the following characters:
Result is a function which can be run in a World.
Possible type specifiers:
Letter | Meaning |
---|---|
S | String or nil |
s | String |
P | (non-String) pointer or nil |
p | (non-String) pointer |
i | int or smaller |
l | long |
v | void |
L | long long |
f | float |
d | double |