Generate a user manual.
All checks were successful
per-push tests / build (push) Successful in 1m11s
per-push tests / test-frontend (push) Successful in 1m3s
per-push tests / test-utility (push) Successful in 1m3s
per-push tests / test-backend (push) Successful in 58s
per-push tests / timed-decomposer-parse (push) Successful in 1m3s

This commit extends the documentation held in instructions.toml into a
full description of the hyphaeVM design and capabilities. Additionally,
instructions.toml is renamed to vm.toml. Finally, the build script
outputs a text file (hyphae_manual.txt) that provides a comprehensive
manual on the use and effects of HyphaeVM.

fixes: #37

Signed-off-by: Ava Affine <ava@sunnypup.io>
This commit is contained in:
Ava Apples Affine 2025-08-14 07:20:03 +00:00
parent f48867db42
commit 0f85292e6f
5 changed files with 1016 additions and 414 deletions

View file

@ -22,7 +22,6 @@ use alloc::rc::Rc;
use alloc::vec::Vec;
use alloc::boxed::Box;
use alloc::fmt::Debug;
use alloc::string::String;
use organelle::Number;
@ -147,7 +146,6 @@ pub enum Datum {
Number(Number),
Bool(bool),
Cons(Cons),
Symbol(String),
Char(u8),
String(Vec<u8>),
Vector(Vec<Gc<Datum>>),
@ -162,7 +160,6 @@ impl Clone for Datum {
Datum::Number(n) => Datum::Number(n.clone()),
Datum::Bool(n) => Datum::Bool(n.clone()),
Datum::Cons(n) => Datum::Cons(n.deep_copy()),
Datum::Symbol(n) => Datum::Symbol(n.clone()),
Datum::Char(n) => Datum::Char(n.clone()),
Datum::String(n) => Datum::String(n.clone()),
Datum::Vector(n) =>

View file

@ -255,7 +255,7 @@ impl VM {
// stack ops
i::PUSH => self.stack.push_current_stack(
access!(&instr.1[0]).deep_copy()),
i::POP => _ = self.stack.pop_current_stack(),
i::POP => self.expr = self.stack.pop_current_stack(),
i::ENTER => self.stack.add_stack(),
i::EXIT => self.stack.destroy_top_stack(),
@ -326,7 +326,7 @@ impl VM {
};
let Datum::Number(ref r) = **access!(&instr.1[1]) else {
e!("illgal argument to IDIV instruction");
e!("illegal argument to IDIV instruction");
};
let Fraction(l, 1) = l.make_exact() else {
@ -562,12 +562,18 @@ impl VM {
i::CONS => {
let mut l = access!(&instr.1[0]).clone();
if let Datum::Cons(l) = l.deref_mut() {
l.append(access!(&instr.1[1]).clone());
self.expr = Datum::Cons(l.deep_copy()).into();
} else {
access!(&instr.1[0], Datum::Cons(Cons(
Some(l),
Some(access!(&instr.1[1]).clone())
)).into());
self.expr = Datum::Cons(Cons(
Some(l.clone()),
None
)).into();
}
if let Datum::Cons(l) = l.deref_mut() {
l.append(access!(&instr.1[1]).deep_copy());
} else {
e!("cons instruction expression register consistency");
}
},