Crates.io | sylt-parser |
lib.rs | sylt-parser |
version | 0.1.0 |
source | src |
created_at | 2021-08-13 21:13:22.314528 |
updated_at | 2021-08-13 21:13:22.314528 |
description | Parser for the Sylt programming language. |
homepage | |
repository | https://github.com/FredTheDino/sylt.git |
max_upload_size | |
id | 435866 |
size | 73,266 |
Sylt is a statically checked and dynamically typed reference counted programming language made for game jams.
Pfft! We objectively have the best logo.
Sylt is written entirely in Rust. There are two main ways of using it.
$ cargo new <game name>
[dependencies.sylt]
git = "https://github.com/FredTheDino/sylt-lang.git"
branch = "main"
features = [ "lingon" ]
src/main.rs
:use std::path::Path;
fn main() {
let args = sylt::Args {
file: Some(Path::new("game.sy").to_path_buf()), // or read from args
is_binary: false,
compile_target: None,
verbosity: 0,
help: false,
};
sylt::run_file(&args, sylt::lib_bindings()).unwrap();
}
x := 0.0
y := 0.0
init :: fn {
l_bind_key("w", "up")
l_bind_key("a", "left")
l_bind_key("s", "down")
l_bind_key("d", "right")
l_bind_quit("quit")
l_bind_key("ESCAPE", "quit")
}
update :: fn delta: float -> void {
x += (l_input_value("right") - l_input_value("left")) * delta
y += (l_input_value("up") - l_input_value("down")) * delta
}
draw :: fn {
rgb :: (sin(l_time()), cos(l_time()), 0.0)
l_gfx_rect! x, y, 1.0, 1.0, rgb
}
start :: fn {
init!
for _ in inf(0) {
_
if l_input_down("quit") {
break
}
l_update!
update! l_delta!
draw!
l_render!
}
}
$ cargo run
to your heart's content.Forking sylt and hacking away makes it easy to do changes to the language, the standard library and the bindings to Lingon, of which the latter two are probably more interesting.
$ cargo run <your-game.sy>
The -v
flag also lets you see some debug output. If you want
to debug the compiler and runtime this might be helpful.
The -vv
flag gives even more debug output. Don't count on seeing anything
from your own program!
A language that has some form of static typechecking, is easy and fast to work in. Performance should be good enough that you don't really have to worry about it.
Dreams exist of automatically recompiling and updating the game while the game is running.