- State “DONE” from “INPROGRESS” [2017-09-10 Sun 09:22]
- State “INPROGRESS” from “TODO” [2017-09-10 Sun 09:22]
- State “DONE” from “INPROGRESS” [2017-09-10 Sun 09:22]
- State “INPROGRESS” from “TODO” [2017-09-10 Sun 09:22]
- State “DONE” from “INPROGRESS” [2017-09-10 Sun 09:23]
Stuck with a list, just subbing out when substitution occurs. - State “INPROGRESS” from “TODO” [2017-09-10 Sun 09:23]
- State “DONE” from “INPROGRESS” [2017-09-10 Sun 09:23]
Switched to protocol for types. - State “INPROGRESS” from “TODO” [2017-09-10 Sun 09:23]
- State “INPROGRESS” from “TODO” [2017-08-04 Fri 10:22]
Standard library [0/2]
- [ ] Add new functions [0/2]
- [ ] map, filter, fold, etc…
- [ ] length, etc…
- [ ] Rewrite some of the built-in functions that are currently in elixir in terp.
- State “INPROGRESS” from “TODO” [2017-08-06 Sun 13:32]
There’s duplication and stuff that can likely be removed now that more functionality is built out. Would like to redo some of the early parsers in the style of more recent ones, e.g. tagging the value.
- [X] Clean up parsers
- [X] Pull out condition bodies from the big case in terp.eval_trees
- [X] Improve documentation
- [ ] Rename some poorly named functions
- [ ] Add typespecs
Need to y-combinate them as well
- State “INPROGRESS” from “TODO” [2017-09-01 Fri 13:16]
Propagate error messages instead of ending in crashes
Currently converting a raw string in both steps. Should just do it once.:w
- State “INPROGRESS” from “TODO” [2017-09-10 Sun 09:19]
Particularly noticeable in the return of cdr
; should be returning a terp list instead of an elixir list.
This is underway; Terp.Value
is currently used when constructing values using HKTs.
Many of the functions that were split out of the eval function still reference it to evaluate their internals.
- State “DONE” from “INPROGRESS” [2017-09-10 Sun 09:17]
Basic pattern matching is implemented using thematch
function. Caveat is that matching is only currently done against value constructors for HKTs, and there is no wildcard yet either. - State “INPROGRESS” from “TODO” [2017-09-10 Sun 09:17]
pmatch
or equivalent, a list of possible cases and evaluate the first that’s true
<2017-08-03 Thu> - Added cond
for multi-possibility conditionals. Pattern matching still to come.
- State “DONE” from “INPROGRESS” [2017-09-10 Sun 09:14]
Calling the basic type system done. There are improvements that can be made (not least of which is a pass through to clean stuff up, but type inference generally works.This includes inference for higher-kinded types (granted, I have only experimented with one and two variable HKTs, I’m assuming it should work further as well).
Defining new types works. Annotating types of functions works, which although it isn’t necessary, makes for nice documentation.
Sum types are implemented. Still need products.
HM type inference
- State “DONE” from “INPROGRESS” [2017-09-10 Sun 09:13]
Type checking works for defined functions/variables. - State “INPROGRESS” from “TODO” [2017-09-10 Sun 09:12]
- State “DONE” from “INPROGRESS” [2017-09-10 Sun 09:13]
Most type errors (e.g. unification, annotation) pass errors back up for pretty printing. - State “INPROGRESS” from “TODO” [2017-09-10 Sun 09:13]
- State “DONE” from “INPROGRESS” [2017-09-10 Sun 09:14]
These statements now type check - State “INPROGRESS” from “TODO” [2017-09-10 Sun 09:14]
- State “DONE” from “INPROGRESS” [2017-09-10 Sun 09:14]
Have type checking for lists. A future refactor is to make lists HKTs and not rely on Elixir’s lists. - State “INPROGRESS” from “TODO” [2017-09-10 Sun 09:14]
- State “DONE” from “INPROGRESS” [2017-08-09 Wed 21:08]
Initial implementation merged today. Doesn’t have scrollback, tab completion, etc… might have to actually hijack the erlang shell to get those. - State “INPROGRESS” from “TODO” [2017-08-09 Wed 21:08]
An elixir shell that just waits for input and runs terp eval on it?
- State “DONE” from “INPROGRESS” [2017-08-05 Sat 14:09]
Export withprovide
, import withrequire
. - State “INPROGRESS” from “TODO” [2017-08-04 Fri 10:22]
module
followed by the module’s name and a list of the functions it exports:
(module Prelude.List
'(length
reverse
...])
To import:
(import Prelude.List) ;; import all functions from the module
(import Prelude.List
'(length)) ;; import just a given function
<2017-08-04 Fri 16:45> Scrapping the above idea and going with something more akin to Racket’s module system. <2017-08-05 Sat 14:05> Gave up yesterday on figuring out how to only export certain functions without having to worry about what might happen if only the exported function was imported but it depended on something that wasn’t exported. Decided to just import everything and have nothing be private. This morning, realized I could load everything, then unbind the hidden functions by updating the environment.
letrec
to define a recursive function
This was a huge headache to actually get working, but so exciting when it did finally work.
My naive attempt was to set up a dummy environment record for the function name so that the name wouldn’t be unbound in the function body. This didn’t end up working very well.
Opted instead to pull out the free variable (e.g. function’s name) from the function body, wrap the definition in an anonymous function, and use the Y-combinator to get the function’s fixpoint. Then set the fixpoint function to the name in the environment.
Strings are now valid.