No description
Find a file
2025-07-08 14:21:16 +02:00
docs update readme; init globals 2023-12-22 22:09:35 +01:00
examples implement namespacing via paths 2025-07-08 14:21:16 +02:00
lib add standard tcb header and experimental mt runtime 2025-03-27 11:39:33 +01:00
tbl implement namespacing via paths 2025-07-08 14:21:16 +02:00
tbl-vscode parse (probably) everything the old parser could 2024-03-09 21:01:56 +01:00
tbl_analysis various updates: schedule expressions, let bindings, attach 2025-02-18 15:52:26 +01:00
tbl_codegen implement namespacing via paths 2025-07-08 14:21:16 +02:00
tbl_lsp implement namespacing via paths 2025-07-08 14:21:16 +02:00
tbl_parser implement namespacing via paths 2025-07-08 14:21:16 +02:00
tree-sitter-tbl various updates: schedule expressions, let bindings, attach 2025-02-18 15:52:26 +01:00
.gitignore implement once blocks 2025-03-23 21:17:49 +01:00
Cargo.lock add standard tcb header and experimental mt runtime 2025-03-27 11:39:33 +01:00
Cargo.toml various updates: schedule expressions, let bindings, attach 2025-02-18 15:52:26 +01:00
README.md implement once blocks 2025-03-23 21:17:49 +01:00
tbl_rt.c implement namespacing via paths 2025-07-08 14:21:16 +02:00
tbl_rt_mt.c implement namespacing via paths 2025-07-08 14:21:16 +02:00
tcb.h add standard tcb header and experimental mt runtime 2025-03-27 11:39:33 +01:00

Task Based Language

What if all your functions were cyclical tasks? The Task Based Language (TBL) is an attempt to create a programming language that captures the essentials of many realtime applications by putting thís idea into the foreground.

TBL is still work in progress. While an example scheduler exists, many features are still missing or only partially implemented. Use at your own risk and report compiler bugs if you find any!

Example

use std;

task print(v: u32) {
	printf("%d\n", v);
}

task count(from: u32) -> u32 {
	uninit n: u32;
	once {
		n = from;
	}
	n = n + 1;
	return n;
}

task main() {
	let t: handle = schedule count(41) every 100ms;
	on t do print;
}

The example above implements a simple counter. Let's start with the main task: As you see, we dont't just call count, we schedule it. This means count will be executed every 100ms. Jumping to the definition of count, you may notice the uninit syntax and once block. These are necessary because scheduled tasks save the state of their local variables every time they run. Putting the initialization of n into a once block ensures that it is only initialized once and the counter will count up as intended. Returning to the main task, you can see that it is also possible to attach tasks to other tasks: Every time count runs, print will be called with its return value and thereby print the current value of n.

If you want to look at some examples that do run, check out the examples folder. You can also read the documentation.