@raviqqe/stak 0.3.6 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,12 +3,80 @@
3
3
  [![GitHub Action](https://img.shields.io/github/actions/workflow/status/raviqqe/stak/test.yaml?branch=main&style=flat-square)](https://github.com/raviqqe/stak/actions)
4
4
  [![Crate](https://img.shields.io/crates/v/stak.svg?style=flat-square)](https://crates.io/crates/stak)
5
5
  [![Codecov](https://img.shields.io/codecov/c/github/raviqqe/stak.svg?style=flat-square)](https://codecov.io/gh/raviqqe/stak)
6
- [![License](https://img.shields.io/github/license/raviqqe/stak.svg?style=flat-square)](LICENSE)
6
+ [![License](https://img.shields.io/github/license/raviqqe/stak.svg?style=flat-square)](https://github.com/raviqqe/stak/blob/main/LICENSE)
7
7
 
8
- The no-`std` and no-`alloc` R7RS Scheme implementation in Rust
8
+ The miniature, embeddable R7RS Scheme implementation in Rust
9
9
 
10
- The documentation is [here](https://raviqqe.github.io/stak).
10
+ The full documentation is [here](https://raviqqe.github.io/stak).
11
+
12
+ ## Install
13
+
14
+ ### Library
15
+
16
+ To install Stak Scheme as a library in your Rust project, run:
17
+
18
+ ```sh
19
+ cargo add stak
20
+ ```
21
+
22
+ ### Command line tools
23
+
24
+ To install the Scheme interpreter and alike as command line tools, run:
25
+
26
+ ```sh
27
+ # Install the Scheme interpreter.
28
+ cargo install stak
29
+
30
+ # Install the minimal Scheme interpreter (6 times smaller!)
31
+ cargo install mstak
32
+
33
+ # Install the Scheme-to-bytecode compiler and bytecode interpreter.
34
+ cargo install stak-compile
35
+ cargo install stak-interpret
36
+ ```
37
+
38
+ ## Examples
39
+
40
+ ### Running a Scheme script
41
+
42
+ ```rust
43
+ use core::error::Error;
44
+ use stak::{
45
+ build::include_bytecode,
46
+ device::StdioDevice,
47
+ file::VoidFileSystem,
48
+ process_context::VoidProcessContext,
49
+ r7rs::{SmallError, SmallPrimitiveSet},
50
+ time::VoidClock,
51
+ vm::Vm,
52
+ };
53
+
54
+ const HEAP_SIZE: usize = 1 << 16;
55
+ const BYTECODES: &[u8] = include_bytecode!("hello.scm");
56
+
57
+ fn main() -> Result<(), Box<dyn Error>> {
58
+ run(BYTECODES)?;
59
+
60
+ Ok(())
61
+ }
62
+
63
+ fn run(bytecodes: &[u8]) -> Result<(), SmallError> {
64
+ let mut heap = [Default::default(); HEAP_SIZE];
65
+ let mut vm = Vm::new(
66
+ &mut heap,
67
+ SmallPrimitiveSet::new(
68
+ StdioDevice::new(),
69
+ VoidFileSystem::new(),
70
+ VoidProcessContext::new(),
71
+ VoidClock::new(),
72
+ ),
73
+ )?;
74
+
75
+ vm.initialize(bytecodes.iter().copied())?;
76
+ vm.run()
77
+ }
78
+ ```
11
79
 
12
80
  ## License
13
81
 
14
- [MIT](LICENSE)
82
+ [MIT](https://github.com/raviqqe/stak/blob/main/LICENSE)
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@raviqqe/stak",
3
3
  "type": "module",
4
4
  "description": "Stak Scheme VM in WebAssembly",
5
- "version": "0.3.6",
5
+ "version": "0.3.8",
6
6
  "license": "SEE LICENSE IN ../LICENSE",
7
7
  "repository": {
8
8
  "type": "git",
package/stak_wasm_bg.wasm CHANGED
Binary file