diff --git a/hyphae/instructions.toml b/hyphae/instructions.toml index 87f6617..fa85567 100644 --- a/hyphae/instructions.toml +++ b/hyphae/instructions.toml @@ -235,6 +235,18 @@ args = ["src"] output = "" description = "mutates a number datum into a char datum" +[[instructions]] +name = "ntoi" +args = ["src"] +output = "" +description = "mutates a number datum into its exact form" + +[[instructions]] +name = "ntoe" +args = ["src"] +output = "" +description = "mutates a number datum into its inexact form" + [[instructions]] name = "mkvec" args = [] @@ -289,14 +301,3 @@ args = ["list"] output = "returns last element in cons cell" description = "takes an AST and returns last element in top level cons cell" -[[instructions]] -name = "parse" -args = ["input"] -output = "parses an AST from input string" -description = "calls parse and lex routine on an input string" - -[[instructions]] -name = "eval" -args = [] -output = "result of compiled instructions" -description = "expects AST in expr. compiles it to instructions and runs them" diff --git a/hyphae/src/vm.rs b/hyphae/src/vm.rs index 1279ee6..089e1fd 100644 --- a/hyphae/src/vm.rs +++ b/hyphae/src/vm.rs @@ -437,12 +437,19 @@ impl VM { e!("illegal argument to CAR instruction"); }; - self.expr = (*arg.0).clone(); + self.expr = (*arg.1).clone(); }, - i::CONS => todo!("implement AST API"), - i::PARSE => todo!("implement AST API"), - i::EVAL => todo!("implement AST API"), + i::CONS => { + /* CONS BEHAVIOR + * L Datum is not list means create a new standard form list + * L Datum is list then append the second element to the first + */ + }, + + // in order to maintain a language agnostic VM these must be traps + //i::PARSE => todo!("implement AST API"), + //i::EVAL => todo!("implement AST API"), _ => { e!("illegal instruction");