1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
"Try 2" of the SLUL programming language
========================================
Notes:
* This programming language is in a very early design phase!
* Currently has the beginnings of a bootstrap compiler, that compiles to C.
* To implement all of the features below, it will probably be necessary
to write a more powerful compiler (e.g. in SLUL), with a custom code
generator / linker.
SLUL is a programming language that...
Will be safe:
* [ ] Type safe, statically typed
* [ ] Memory safe
* [ ] Null safe
* [ ] Integer range safe
* [ ] Capabilities
* [ ] Pure/immutable by default
* [ ] Safe to build (no unrestricted build-time execution)
* [ ] Safe upgrades of libraries (without possibly violating constraints above)
```
?Thing t = get_thing 123
assert t <> none # t can be accessed after this.
assert b <= 254 # assuming that the range of b is 0-255,
b += 1 # this addition is now allowed.
```
Will be lightweight:
* [ ] Small runtime
* [ ] Native code compilation
* [ ] Arena allocation, with optional garbage collection
* [ ] Compile-time generics using type erasure (avoids duplication)
Will be usable:
* [ ] Minimal surprises
* [x] Minimal punctuation
* [ ] Maybe name-based type inferrence
Will be "modules first":
* [ ] API compatibility enforced by compiler
(cryptographically hashed interfaces)
* [ ] Dynamic linking
* [ ] Link to minimal version of dependencies
* [ ] Build environment needs only interface files of (direct) dependencies
* [ ] Easily build and replace any program of library, without having to
rebuild any another components.
Will be platform-independent / portable:
* [ ] SLUL code will be fully platform independent
(assuming that dependencies exist/work on the target platform).
* [ ] Trivial cross-compilation (not in the bootstrap compiler,
which compiles to C)
Building it
-----------
Requirements:
* C89+ compiler with 64-bit types (such as GCC, Clang, TCC, ...)
* GNU Make or BSD Make
```
cd bootstrap
make
```
SLUL "try2" vs. original SLUL
-----------------------------
This an attempt to make my previous experimental progamming language
simpler and easier to use. Main changes:
* Less punctuation (no `(` around simple function calls)
* Function definitions have one parameter definition per line, which
allows documentation to appear in a comment on the line before.
* Implicit namespace/class per file
(this way "globals" are actually instance variables).
* Probably won't have hard-coded integers (int8, int16...)
* Generic types might use `of`, `from`, and `to` keywords.
For example, `List of Int` or `Map from Int to String`. Not decided yet.
License
-------
Copyright © 2025 Samuel Lidén Borell.
This software is free/libre/open source software. You may distribute it
and/or modify it under the terms of either of the following licenses:
* EUPL v. 1.2 or (at your option) any later version, or
* LGPL v. 2.1 or (at your option) any later version.
The EUPL license can be found in the file `LICENSE.txt`, and the LGPL
license can be found in the file `lgpl-2.1.txt`.
The `+` in file headers etc., for example `EUPL-1.2+`, should be read as
"or any later version". It still refers to the same EUPL v. 1.2 license.
As an additional option, the runtime library may be distributed and/or
modified under the terms of the MIT-0 license, which can be found in
`bootstrap/rtl/LICENSE`. This applies to the following files and
directories:
* `bootstrap/compiler.h`
* `bootstrap/rtl/`
* `bootstrap/rtlincl/`
If you contribute to the project, you accept that your contributions will
permanently be made available under the terms of both the EUPL and the LGPL
licenses. If you contribute to the runtime library, you *additionally* accept
that your contributions will be available under the MIT-0 license as well.
|