• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

A categorical programming language


Commit MetaInfo

修订版8b1976afe564a720daabd0c759e553b734e61da6 (tree)
时间2022-12-01 08:37:48
作者Corbin <cds@corb...>
CommiterCorbin

Log Message

Wire up jelly to Honey.

更改概述

差异

--- a/default.nix
+++ b/default.nix
@@ -58,5 +58,5 @@ in {
5858 '';
5959 };
6060 movelist = movelist;
61- honey = pkgs.callPackage ./honey { cammy = movelist; };
61+ honey = pkgs.callPackage ./honey { inherit jelly; cammy = movelist; };
6262 }
--- a/honey/default.nix
+++ b/honey/default.nix
@@ -1,6 +1,6 @@
11 { stdenv,
22 python3Packages, purescript,
3- cammy }:
3+ cammy, jelly }:
44 stdenv.mkDerivation {
55 name = "honey";
66 version = "0.0.1";
@@ -12,6 +12,7 @@ stdenv.mkDerivation {
1212 mkdir -p $out/share/
1313 substitute honey.py $out/share/honey.py \
1414 --subst-var-by CAMMY "${cammy}/bin/" \
15+ --subst-var-by JELLY "${jelly}/bin/" \
1516 --subst-var-by PURS "${purescript}/bin/" \
1617 --subst-var-by SHARE "$out/share/"
1718 cp constants.py parser.py $out/share/
--- a/honey/honey.py
+++ b/honey/honey.py
@@ -11,6 +11,7 @@ from constants import CORE_TEMPLATES
1111 from parser import parse
1212
1313 CAMMY = "@CAMMY@"
14+JELLY = "@JELLY@"
1415 PURESCRIPT = "@PURS@"
1516 SHAREPATH = "@SHARE@"
1617
@@ -209,9 +210,18 @@ def isTemplate(expr):
209210 if isinstance(expr, str): return expr.startswith("@")
210211 return any(isTemplate(arg) for arg in expr)
211212
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+
212221 @app.route("/dissolve", methods=["POST"])
213222 def dissolveNewExpression():
214223 sexp = request.get_data(as_text=True)
224+ sexp = jellify(sexp)
215225 expr, trail = parse(sexp)
216226 if isTemplate(expr):
217227 print("can't handle templates yet")