https://github.com/cloakersmoker/relax-language
A compiled programming language
https://github.com/cloakersmoker/relax-language
compiled-language programming-language
Last synced: 4 months ago
JSON representation
A compiled programming language
- Host: GitHub
- URL: https://github.com/cloakersmoker/relax-language
- Owner: CloakerSmoker
- License: lgpl-3.0
- Created: 2019-11-13T15:30:01.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-07-22T07:51:28.000Z (11 months ago)
- Last Synced: 2025-07-22T09:38:53.727Z (11 months ago)
- Topics: compiled-language, programming-language
- Language: AutoHotkey
- Homepage:
- Size: 12.2 MB
- Stars: 24
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# A basic compiled programming language.

Note: The compiler is now bootstrapped, it used to be implemented in AutoHotkey. Yes, I regret that.
For more info, see the [docs](https://cloakersmoker.github.io/Relax-Language/#).
## A quick peek at some code
```
/* Paths are relative to the root directory of the repo, compiler should be ran with:
./build/compiler.exe -i path/to/this_file.rlx -o path/to/binary.exe
to ensure the working dir is correct.
*/
#Include ./src/lib/Memory.rlx
#Include ./src/lib/String.rlx
#Include ./src/lib/Console.rlx
define i32 Main(i64 ArgC, i8** ArgV) {
GetArgs(&ArgC, &ArgV) ; Ensures that ArgC/ArgV are set on Windows, does nothing on Linux
i64 Left := AToI(ArgV[1])
i64 Right := AToI(ArgV[3])
i8 Operator := ArgV[2][0]
/* The `Print` function is overloaded, with the `i64` version implemented as
Print(IToA(Number))
with the `i8*`/string overload of the `Print` function working as
WriteFile(StdOut, String)
when compiled for Windows, and
sys_write(StdOut, String)
when compiled for Linux
*/
if (Operator = '+') {
Print(Left + Right)
}
else if (Operator = '-') {
Print(Left - Right)
}
else if (Operator = '*') {
Print(Left * Right)
}
else if (Operator = '/') {
Print(Left / Right)
}
return 0 /* Returns from `Main()` like normal on Windows, calls `sys_exit(0)` on Linux */
}
```
(For more examples, check out the tests inside of `tests/`, or the compiler source itself in `src/compiler/`)