Skip to content

Commit

Permalink
some more tweeks
Browse files Browse the repository at this point in the history
  • Loading branch information
CrowdHailer committed Oct 10, 2022
1 parent afa7394 commit d97e121
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 10 deletions.
22 changes: 20 additions & 2 deletions editor/public/saved.json
Original file line number Diff line number Diff line change
Expand Up @@ -3057,8 +3057,26 @@
"elements": []
},
"then": {
"node": "Binary",
"value": "TODO encode"
"node": "Call",
"function": {
"node": "Access",
"value": {
"node": "Variable",
"label": "builtin"
},
"key": "serialize"
},
"with": {
"node": "Function",
"pattern": {
"node": "Variable",
"label": ""
},
"body": {
"node": "Tuple",
"elements": []
}
}
}
}
]
Expand Down
9 changes: 6 additions & 3 deletions editor/src/other.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ import data from "../public/saved.json";
// let target = new URL(document.currentScript.src).hash.slice(1);
// console.log(target, Analysis);

(async function name() {
async function GoGoGo() {
const source = Encode.from_json(data);
const initial = Entry.interpret_client(source, "counter");
console.log(initial);
const { default: next } = await import("../public/saved.json");
console.log(Encode.from_json(data));
})();
console.log(Encode.from_json(next));
}

console.log(window, GoGoGo);
window.GoGoGo = GoGoGo;
GoGoGo();
// Started doing this because the code gen was troublesome, also in code gen we will nee to pull in the loader
// here we have can use the already existing gleam .run
20 changes: 15 additions & 5 deletions eyg/src/eyg/entry.gleam
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import gleam/io
import gleam/map
import gleam/option.{None}
import gleam/string
import eyg/ast/encode
import eyg/ast/expression as e
Expand All @@ -7,20 +9,26 @@ import eyg/interpreter/effectful
import eyg/interpreter/tail_call
import gleam/javascript/array
import eyg/interpreter/interpreter as r
import eyg/ast/pattern as p
import eyg/analysis
import eyg/typer
import eyg/typer/monotype as t
import eyg/editor/editor


fn update(page, interrupt, display, on_click) {
io.debug(page)
display(page)
}

fn b(args) {
Ok(r.Binary("done"))
Ok(args)
}

fn tree() {
r.Function(p.Variable("x"), e.tuple_([e.variable("x"),e.variable("x")]), map.new(), None)
}

// uses default builtin that need moving out of effectful
// has an entry point key should eventually be a hash
// maybe rename interpret standard
Expand All @@ -35,11 +43,13 @@ pub fn interpret_client(source, key, display, on_click) {
io.debug("---- typed")
let #(xtyped, typer) =
typer.expand_providers(typed, typer, [])
// assert Ok(term) = effectful.eval(editor.untype(xtyped))
// io.debug(term)
// Running the interpreter kills the client
// assert Ok(term) = effectful.eval(editor.untype(xtyped))
// io.debug(term)
|> io.debug
io.debug("expanded")
effectful.eval_call(tree(), r.Binary("nothing exciting"), effectful.real_log)
|> io.debug
// effectful.eval_call(r.BuiltinFn(b), term, effectful.real_log)
// |> io.debug
// // TODO make an AST the requires rendering
// term
}

0 comments on commit d97e121

Please sign in to comment.