Crates.io | bytor |
lib.rs | bytor |
version | 0.1.0 |
source | src |
created_at | 2024-08-02 03:11:28.969102 |
updated_at | 2024-08-02 03:11:28.969102 |
description | A small WIP programming language |
homepage | |
repository | https://github.com/drewrip/bytor |
max_upload_size | |
id | 1322766 |
size | 133,259 |
A language inspired by Pascal and Rust
My high level goal was to develop a language that makes writing an imperative style of code feel more sound. I haven't fully developed the language constructs that will make this possible but I have a number of rough sources of inspirations.
This is an incredibly simple example of calculating the n
'th Fibonacci sequence.
Currently the only way to observe output is via the return code of the program.
fun fib(n: int32) -> int32 begin
if n == 0 then
return 0;
else if n == 1 then
return 1;
end
return fib(n - 1) + fib(n - 2);
end
program calc_fib begin
let index = 7;
return fib(index);
end
You can try the latest version of the compiler with using some basic gcc
like options.
Build the Rascal compiler rascalc
with Cargo and ensure you have
gcc
installed. Then you can compile the calc_fib
example above by running:
rascalc fib.ras -o fib
I'm currently developing the basics of the language. My original goal was to target WASM,
however in an effort to speed up language development and hopefully ensure that Rascal isn't just
"high level" WASM, I'm starting by generating C. Then we can call to gcc
.
I'm hoping to bring the backends/wasm.rs
WASM backend up to date later.