From c1fe72ae2b94d37cbf027aa185c27307d9776c56 Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Wed, 11 Feb 2015 21:56:47 -0600 Subject: miniMAL: step1. --- miniMAL/printer.json | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 miniMAL/printer.json (limited to 'miniMAL/printer.json') diff --git a/miniMAL/printer.json b/miniMAL/printer.json new file mode 100644 index 0000000..28d5d4d --- /dev/null +++ b/miniMAL/printer.json @@ -0,0 +1,25 @@ +["do", + +["def", "pr-str", ["fn", ["exp", "print_readably"], + ["if", ["list?", "exp"], + ["str", + ["`", "("], + [".", ["map", ["fn", ["x"], ["pr-str", "x", "print_readably"]], "exp"], + ["`", "join"], ["`", " "]], + ["`", ")"]], + ["if", ["=", ["`", "string"], ["type", "exp"]], + ["str", ["`", "\""], "exp", ["`", "\""]], + ["if", ["=", ["`", "number"], ["type", "exp"]], + "exp", + ["if", ["=", null, "exp"], + ["`", "nil"], + ["if", ["=", true, "exp"], + ["`", "true"], + ["if", ["=", false, "exp"], + ["`", "false"], + ["if", ["=", ["`", "Symbol"], ["get", "exp", ["`", "type"]]], + ["get", "exp", ["`", "val"]], + ["str", ["`", "#"]]]]]]]]]]], + +null +] -- cgit v1.2.3