A categorical programming language
Revision | 8b1976afe564a720daabd0c759e553b734e61da6 (tree) |
---|---|
Time | 2022-12-01 08:37:48 |
Author | Corbin <cds@corb...> |
Commiter | Corbin |
Wire up jelly to Honey.
@@ -58,5 +58,5 @@ in { | ||
58 | 58 | ''; |
59 | 59 | }; |
60 | 60 | movelist = movelist; |
61 | - honey = pkgs.callPackage ./honey { cammy = movelist; }; | |
61 | + honey = pkgs.callPackage ./honey { inherit jelly; cammy = movelist; }; | |
62 | 62 | } |
@@ -1,6 +1,6 @@ | ||
1 | 1 | { stdenv, |
2 | 2 | python3Packages, purescript, |
3 | - cammy }: | |
3 | + cammy, jelly }: | |
4 | 4 | stdenv.mkDerivation { |
5 | 5 | name = "honey"; |
6 | 6 | version = "0.0.1"; |
@@ -12,6 +12,7 @@ stdenv.mkDerivation { | ||
12 | 12 | mkdir -p $out/share/ |
13 | 13 | substitute honey.py $out/share/honey.py \ |
14 | 14 | --subst-var-by CAMMY "${cammy}/bin/" \ |
15 | + --subst-var-by JELLY "${jelly}/bin/" \ | |
15 | 16 | --subst-var-by PURS "${purescript}/bin/" \ |
16 | 17 | --subst-var-by SHARE "$out/share/" |
17 | 18 | cp constants.py parser.py $out/share/ |
@@ -11,6 +11,7 @@ from constants import CORE_TEMPLATES | ||
11 | 11 | from parser import parse |
12 | 12 | |
13 | 13 | CAMMY = "@CAMMY@" |
14 | +JELLY = "@JELLY@" | |
14 | 15 | PURESCRIPT = "@PURS@" |
15 | 16 | SHAREPATH = "@SHARE@" |
16 | 17 |
@@ -209,9 +210,18 @@ def isTemplate(expr): | ||
209 | 210 | if isinstance(expr, str): return expr.startswith("@") |
210 | 211 | return any(isTemplate(arg) for arg in expr) |
211 | 212 | |
213 | +def jellify(sexp): | |
214 | + try: | |
215 | + return subprocess.check_output(JELLY + "jelly", | |
216 | + input=sexp.encode("utf-8")).decode("utf-8") | |
217 | + except subprocess.CalledProcessError: | |
218 | + print("Couldn't jellify", sexp) | |
219 | + raise | |
220 | + | |
212 | 221 | @app.route("/dissolve", methods=["POST"]) |
213 | 222 | def dissolveNewExpression(): |
214 | 223 | sexp = request.get_data(as_text=True) |
224 | + sexp = jellify(sexp) | |
215 | 225 | expr, trail = parse(sexp) |
216 | 226 | if isTemplate(expr): |
217 | 227 | print("can't handle templates yet") |