aboutsummaryrefslogtreecommitdiff
path: root/crates/sloth_vm/src/value.rs
diff options
context:
space:
mode:
authorCody <cody@codyq.dev>2023-06-07 03:28:40 -0500
committerCody <cody@codyq.dev>2023-06-07 03:28:40 -0500
commit6f6613419f1511c5637c9f69b3caa5ae838270b9 (patch)
treee203d6cdc0eb2140ae6f0a430e76f2992de66bec /crates/sloth_vm/src/value.rs
parent25c5ccb29a6f2387a04bfb5d50874e00084c15d6 (diff)
downloadsloth-6f6613419f1511c5637c9f69b3caa5ae838270b9.tar.gz
Moving over from a VM interpreter to natively compiled w/ LLVM
Diffstat (limited to 'crates/sloth_vm/src/value.rs')
-rw-r--r--crates/sloth_vm/src/value.rs53
1 files changed, 0 insertions, 53 deletions
diff --git a/crates/sloth_vm/src/value.rs b/crates/sloth_vm/src/value.rs
deleted file mode 100644
index 4450b5a..0000000
--- a/crates/sloth_vm/src/value.rs
+++ /dev/null
@@ -1,53 +0,0 @@
-use crate::native::NativeFunction;
-use crate::Chunk;
-
-#[derive(Debug, Clone, Copy, PartialEq)]
-pub enum Primitive {
- Integer(i128),
- Float(f64),
- Bool(bool),
- /// Pointer to an object living on heap
- Object(u32),
- Empty,
-}
-
-pub struct Object {
- /// If the object has been marked by the VM or not
- pub(crate) marked: bool,
- pub(crate) typ: ObjectType,
-}
-
-impl Object {
- pub fn new(typ: ObjectType) -> Self {
- Self { marked: false, typ }
- }
-}
-
-pub enum ObjectType {
- Box(Primitive),
- String(String),
- List(Vec<Primitive>),
-
- Function(Function),
- NativeFunction(NativeFunction),
-
- Free { next: usize },
-}
-
-pub struct Function {
- pub name: Option<String>,
- pub chunk: Chunk,
- pub arity: u8,
- pub returns_value: bool,
-}
-
-impl Function {
- pub fn root(chunk: Chunk) -> Self {
- Self {
- name: None,
- chunk,
- arity: 0,
- returns_value: false,
- }
- }
-}