Commit Graph

10 Commits

Author SHA1 Message Date
b4ae936832 Add comment processing, add a comment to factorial.sy to test it out
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-02-11 18:31:12 -08:00
abd7f7960a Fix T and F builtins to be values, not functions
* T and F were builtins that were created as functions. They have been
  changed to just be global values instead, so you don't need to suffix
  them with ! to get the creamy value inside.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-02-11 11:38:43 -08:00
1f642b9739 Change if function stack ordering, add some basic math ops to Int, add factorial example
* `if` function stack ordering is changed to use condition, if-false,
  if-true (bottom to top). This is so we can pass a value on top of the
  stack directly to a new `if` in a condition, so we don't have to store
  a new value in a new variable.
* Add __splat__ and __minus__ functions to Int
* Add * and - builtins, which call the __splat__ and __minus__ functions
  of the top stack item, respectively.
* Add factorial example because now factorials are possible with this
  skeleton implementation, albeit a little hacky with the recursion.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-02-11 11:10:14 -08:00
cb9e09064a Implement __bool__, add if builtin, vtable imporvements
* `if` builtin is the big one here - branching! Yay!
* The `if` builtin requires __bool__ to be implemented for things. This
  is added for all builtin objects.
* Vtables have slightly better ergonomics.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-02-04 17:29:41 -08:00
67054b2c84 Update branching example to use new syntax
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-01-16 16:49:09 -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
ced903c0c1 Update hello world example to match new syntax
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-01-16 14:05:28 -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
c31be8142c Update hello world to use a function
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-01-12 19:43:29 -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