Commit Graph

17 Commits

Author SHA1 Message Date
95fc8a85df Rename mod object->obj
Also, object.rs got moved to a new directory in preparation for
splitting members out into their own files

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-01-24 18:10:21 -08:00
ea01f8e191 Remove Rc wrapping of BuiltinFnPtr in BuiltinFn wrapper
I'm trying to remember why this was added in the first place - I think
to simplifly cloning? It's not important now though.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-01-24 17:53:29 -08:00
070e497e1f Objs replace Values
* Obj is now a trait instead of a struct
* Value enum is gone, replaced with individual structs that implement
  Obj
* All instances where a Value was used, a Gc<(dyn Obj + 'static)> takes
  its place. ObjPtr is shorthand for this.
* A __str__ method for objects is implemented for a couple builtin types
  as a proof-of-concept
* println and print builtin functions are implemented using this
  interface

There's still a lot to do, mostly with interned values. For example,
whenever a new string object is created, a new __str__ function object
is created each time, rather than reusing the first one that was
created. Stuff like that.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-01-18 14:39:06 -08:00
d06e1b82dd Remove max_arena_objects configuration
This isn't something we can't really control so out it goes, I guess.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-01-17 19:51:19 -08:00
5d30719fa2 Remove Obj and Arena
These weren't being used and they didn't have very good implementations.
Movin' on up

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-01-17 19:15:22 -08:00
953fe7cb2a Squash some more warnings from unused member in Machine
We're not using objects yet, so the object arena isn't being used.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-01-16 19:53:08 -08:00
69431c4926 Add vm::builtins mod as a place for builtin functions to live
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-01-16 19:22:02 -08:00
b3cf1c5681 Add call site discovery to call frames, and add call stack error messages
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-01-16 18:56:33 -08:00
1eb7eb73cb Remove RuntimeSpanError and just incorporate it into RuntimeError; add Span information to compiled instructions
* RuntimeSpanError was an extraneous solution to adding spans to the
  errors; so instead this behavior has been delegated to the
  RuntimeError itself.
* Usage of Inst has mostly been replaced with SpInst so if an error is
  encountered, we can spit out where it happened in the source code
  (hopefully with a stack trace).

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-01-16 16:49:54 -08:00
9704e07c45 Add call stack error chain
This allows us to write out errors that follow the call stack and give
locations to where errors originated.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-01-16 15:25:58 -08:00
effa99e65d Add Stmt and incorporate meta statements
This helps split up expressions, meta calls (like includes) that can be
expanded into more expressions.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-01-16 14:14:50 -08:00
88080c750b Rename bang->apply
! syntax item has been referred to as "bang" instead of "apply" in some
places, this is fixed

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-01-12 22:14:54 -08:00
90f27a4108 Add branching and more coherent method of function calls
We're turing-complete, babey!

* Call stack for functions now differentiates between native and quote
  calls
* Better API for builtin functions allowing for more control
* Example showing off branches

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-01-12 21:49:41 -08:00
907c8ce1af Move src/syn/word.rs to src/scope.rs; add BuiltinFn
* crate::scope instead of crate::syn::word, which makes more sense
  because scopes are not really used in syntax at all
* Reference-counted BuiltinFn values are available for creation now

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-01-12 18:00:11 -08:00
1c669decc4 Finally have things printing to the screen
Nothing fancy yet. This commit adds a bunch of stuff (oops):

* compiling code
* VM with instructions
* remove eval.rs and just eval in the Machine struct itself
* squash most warnings now that we're using stuff here

And probably more. But that's all for now folks

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-01-12 17:35:48 -08:00
cbe22bb89e Start adding eval and machine implementations, remove Inst for now
We're not compiling yet and mostly want to get the name stuff figured
out. Also may switch to using anyhow error handling.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-01-08 10:13:27 -08:00
9e20dcf59c Add parser, vm, objects
Big ol thing. You should check it out sometime

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-01-07 20:30:55 -08:00