46 releases

new 0.4.7 May 18, 2024
0.4.2 Apr 28, 2024
0.3.23 Mar 31, 2024
0.2.1 Dec 3, 2023
0.2.0 Oct 17, 2023

#195 in Memory management

Download history 78/week @ 2024-01-26 261/week @ 2024-02-09 313/week @ 2024-02-16 52/week @ 2024-02-23 1710/week @ 2024-03-01 979/week @ 2024-03-08 598/week @ 2024-03-15 1255/week @ 2024-03-22 753/week @ 2024-03-29 648/week @ 2024-04-05 1302/week @ 2024-04-12 588/week @ 2024-04-19 917/week @ 2024-04-26 305/week @ 2024-05-03 597/week @ 2024-05-10

2,580 downloads per month
Used in 16 crates (11 directly)

Custom license

87KB
2.5K SLoC

Stak Scheme

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