diff options
| author | Nic Gaffney <gaffney_nic@protonmail.com> | 2023-04-14 00:25:32 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-14 00:25:32 -0500 |
| commit | 97b7cd10d2bec408cc237e13c61562c810d8fd29 (patch) | |
| tree | 03d4151581277209f3df48c1a49a656c6c32a52b /crates/sloth_vm/src/sloth_std/mod.rs | |
| parent | 6b25c191a4522610877898506856bd00cd1fc4d5 (diff) | |
| parent | fa0da150a5a481be3d1de448edb6f23c170da9a9 (diff) | |
| download | sloth-97b7cd10d2bec408cc237e13c61562c810d8fd29.tar.gz | |
Merge pull request #4 from slothlang/vm-basics
Basic VM
Diffstat (limited to 'crates/sloth_vm/src/sloth_std/mod.rs')
| -rw-r--r-- | crates/sloth_vm/src/sloth_std/mod.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/crates/sloth_vm/src/sloth_std/mod.rs b/crates/sloth_vm/src/sloth_std/mod.rs new file mode 100644 index 0000000..86611d7 --- /dev/null +++ b/crates/sloth_vm/src/sloth_std/mod.rs @@ -0,0 +1,24 @@ +use std::collections::HashMap; + +use once_cell::sync::Lazy; + +use crate::native::NativeFunction; + +pub mod rand; +pub mod stdio; + +pub static NATIVE_LIBRARY: Lazy<HashMap<&'static str, NativeFunction>> = Lazy::new(|| { + let mut map = HashMap::new(); + + // rand + map.insert("rand$gen", rand::GEN_FUNCTION); + map.insert("rand$gen_range", rand::GEN_RANGE_FUNCTION); + + // stdio + map.insert("write", stdio::WRITE_FUNCTION); + map.insert("read", stdio::READ_FUNCTION); + + // filesystem + + map +}); |
