From f625d1bca760bcd66c59a53a6b42ad877e78fb51 Mon Sep 17 00:00:00 2001 From: sogaiu <983021772@users.noreply.github.com> Date: Fri, 23 Apr 2021 01:45:27 +0900 Subject: [PATCH] Add step 0 --- Makefile.impls | 3 ++- impls/fennel/run | 3 +++ impls/fennel/step0_repl.fnl | 21 +++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100755 impls/fennel/run create mode 100644 impls/fennel/step0_repl.fnl diff --git a/Makefile.impls b/Makefile.impls index 7e92f863..736280fe 100644 --- a/Makefile.impls +++ b/Makefile.impls @@ -33,7 +33,7 @@ wasm_MODE = wasmtime # IMPLS = ada ada.2 awk bash basic bbc-basic c chuck clojure coffee common-lisp cpp crystal cs d dart \ - elisp elixir elm erlang es6 factor fantom forth fsharp go groovy gnu-smalltalk \ + elisp elixir elm erlang es6 factor fantom fennel forth fsharp go groovy gnu-smalltalk \ guile haskell haxe hy io janet java js jq julia kotlin livescript logo lua make mal \ matlab miniMAL nasm nim objc objpascal ocaml perl perl6 php picolisp pike plpgsql \ plsql powershell prolog ps python python.2 r racket rexx rpython ruby rust scala scheme skew \ @@ -123,6 +123,7 @@ erlang_STEP_TO_PROG = impls/erlang/$($(1)) es6_STEP_TO_PROG = impls/es6/$($(1)).mjs factor_STEP_TO_PROG = impls/factor/$($(1))/$($(1)).factor fantom_STEP_TO_PROG = impls/fantom/lib/fan/$($(1)).pod +fenne_STEP_TO_PROG = impls/fennel/$($(1)).fnl forth_STEP_TO_PROG = impls/forth/$($(1)).fs fsharp_STEP_TO_PROG = impls/fsharp/$($(1)).exe go_STEP_TO_PROG = impls/go/$($(1)) diff --git a/impls/fennel/run b/impls/fennel/run new file mode 100755 index 00000000..2651be86 --- /dev/null +++ b/impls/fennel/run @@ -0,0 +1,3 @@ +#!/bin/bash + +exec fennel $(dirname $0)/${STEP:-stepA_mal}.fnl "${@}" diff --git a/impls/fennel/step0_repl.fnl b/impls/fennel/step0_repl.fnl new file mode 100644 index 00000000..394c4f1c --- /dev/null +++ b/impls/fennel/step0_repl.fnl @@ -0,0 +1,21 @@ +(fn READ [code-str] + code-str) + +(fn EVAL [ast] + ast) + +(fn PRINT [ast] + ast) + +(fn rep [code-str] + (PRINT (EVAL (READ code-str)))) + +(var done false) + +(while (not done) + (io.write "user> ") + (io.flush) + (let [input (io.read)] + (if (not input) + (set done true) + (print (rep input)))))