1
1
mirror of https://github.com/kanaka/mal.git synced 2024-11-09 18:06:35 +03:00

fsharp: Add step 0

This commit is contained in:
Peter Stephens 2015-02-21 21:43:40 -06:00
parent 2a42d82740
commit 1c358979bf
4 changed files with 67 additions and 1 deletions

3
.gitignore vendored
View File

@ -24,6 +24,9 @@ cs/*.dll
cs/*.mdb
clojure/target
clojure/.lein-repl-history
fsharp/*.exe
fsharp/*.dll
fsharp/*.mdb
go/step*
go/mal
java/target/

View File

@ -10,7 +10,7 @@ PYTHON = python
# Settings
#
IMPLS = bash c clojure coffee cs forth go haskell java js lua make mal \
IMPLS = bash c clojure coffee cs forth fsharp go haskell java js lua make mal \
ocaml matlab perl php ps python r racket ruby rust scala vb
step0 = step0_repl
@ -55,6 +55,7 @@ clojure_STEP_TO_PROG = clojure/src/$($(1)).clj
coffee_STEP_TO_PROG = coffee/$($(1)).coffee
cs_STEP_TO_PROG = cs/$($(1)).exe
forth_STEP_TO_PROG = forth/$($(1)).fs
fsharp_STEP_TO_PROG = fsharp/$($(1)).exe
go_STEP_TO_PROG = go/$($(1))
java_STEP_TO_PROG = java/src/main/java/mal/$($(1)).java
haskell_STEP_TO_PROG = haskell/$($(1))
@ -86,6 +87,7 @@ clojure_RUNSTEP = lein with-profile +$(1) trampoline run $(3)
coffee_RUNSTEP = coffee ../$(2) $(3)
cs_RUNSTEP = mono ../$(2) --raw $(3)
forth_RUNSTEP = gforth ../$(2) $(3)
fsharp_RUNSTEP = mono ../$(2) --raw $(3)
go_RUNSTEP = ../$(2) $(3)
haskell_RUNSTEP = ../$(2) $(3)
java_RUNSTEP = mvn -quiet exec:java -Dexec.mainClass="mal.$($(1))" -Dexec.args="--raw$(if $(3), $(3),)"

36
fsharp/Makefile Normal file
View File

@ -0,0 +1,36 @@
#####################
DEBUG =
TESTS =
SOURCES_LISP =
#####################
SRCS = step0_repl.fs
FLAGS = $(if $(strip $(DEBUG)),-debug+,)
#####################
all: $(patsubst %.fs,%.exe,$(SRCS))
%.exe: %.fs
fsharpc $(FLAGS) $<
clean:
rm -f *.dll *.exe *.mdb
.PHONY: stats tests $(TESTS)
stats: $(SOURCES)
@wc $^
stats-lisp: $(SOURCES_LISP)
@wc $^
tests: $(TESTS)
$(TESTS):
@echo "Running $@"; \
./$@ || exit 1; \

25
fsharp/step0_repl.fs Normal file
View File

@ -0,0 +1,25 @@
module REPL
let read input =
input
let eval ast =
ast
let print v =
printfn "=> %A" v
let rep input =
input
|> read
|> eval
|> print
[<EntryPoint>]
let rec main args =
let input = System.Console.ReadLine()
match input with
| null -> 0
| input ->
rep input
main args