stak-vm 0.12.12

Virtual machines for Stak Scheme
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::{Exception, memory::Memory};
use winter_maybe_async::maybe_async;

/// A primitive set.
///
/// [`PrimitiveSet`](PrimitiveSet)s provide primitive functionalities, such as
/// arithmetic and I/O, to [`Vm`](super::Vm)s. Each primitive has its own
/// identifier.
pub trait PrimitiveSet<H>: Sized {
    /// An error.
    type Error: Exception;

    /// Runs a primitive on a virtual machine.
    #[maybe_async]
    fn operate(&mut self, memory: &mut Memory<H>, primitive: usize) -> Result<(), Self::Error>;
}