35 releases

new 0.3.27 Apr 12, 2024
0.3.23 Mar 31, 2024
0.2.1 Dec 3, 2023
0.2.0 Oct 17, 2023

#98 in Memory management

Download history 58/week @ 2024-01-03 1419/week @ 2024-01-10 91/week @ 2024-01-17 110/week @ 2024-01-24 154/week @ 2024-02-07 260/week @ 2024-02-14 191/week @ 2024-02-21 1253/week @ 2024-02-28 1020/week @ 2024-03-06 698/week @ 2024-03-13 1293/week @ 2024-03-20 834/week @ 2024-03-27 594/week @ 2024-04-03

3,435 downloads per month
Used in 13 crates (9 directly)

Custom license

85KB
2K SLoC

Stak

GitHub Action Crate Codecov License

No-std and no-alloc Scheme implementation in Rust

The documentation is here.

License

MIT


lib.rs:

A virtual machine and its runtime values.

Examples

use stak_device::FixedBufferDevice;
use stak_macro::compile_r7rs;
use stak_primitive::SmallPrimitiveSet;
use stak_vm::Vm;

const HEAP_SIZE: usize = 1 << 16;
const BUFFER_SIZE: usize = 1 << 10;

let mut heap = [Default::default(); HEAP_SIZE];
let device = FixedBufferDevice::<BUFFER_SIZE, 0>::new(&[]);
let mut vm = Vm::new(&mut heap, SmallPrimitiveSet::new(device)).unwrap();

const PROGRAM: &[u8] = compile_r7rs!(r#"
    (import (scheme write))

    (display "Hello, world!")
"#);

vm.initialize(PROGRAM.iter().copied()).unwrap();
vm.run().unwrap();

assert_eq!(vm.primitive_set().device().output(), b"Hello, world!");

Dependencies