Reference: Simon L. Payton Jones, David R. Lester Implementing Functional Languages: a tutorial, 1991
$ cabal run ifl -- -V
____________
/ _/ ____/ /
/ // /_ / /
_/ // __/ / /___
/___/_/ /_____/ Implimenting Functional Languages
> cabal run ifl -- [OPTION...] <program-file>
OPTION
-c Compiler --compiler=Compiler compiler name (mark1 | mark2 | mark3 | mark4 | mark5 | mark5alt | mark5gc | mark5revgc | mark5cp | gmark1 | gmark2 | gmark3 | gmark4 | gmark5 | gmark6 | gmark7 | timark1 | timark1cp | timark2 | timark3 | timark4 | timark5 | timark6)
-v --verbose step output on stderr
-t Threshold --threshold=Threshold threshold for Garbage Collection
-l --convert-to-list-based convert to list based program
-p --profile profile output
-V, -? --version show version
$ cat test.ifl
fib n = if (n<2) 1 (fib (n-1) + fib (n-2));
main = fib 10
$ docker run -v ./:/work -it --rm cutsea110/ifl:0.3.18 ifl -c gmark7 /work/test.ifl
89
How to confirm compiled code of any program for debug on Gmachine.Mark7.
ghci> let p = "s f g x = f x (g x)"
ghci> compileSc [] . head . parse $ p
When you take recursive function, you have to give an environment like below:
ghci> let p = "fib n = if (n<2) 1 (fib (n-1) + fib (n-2))"
ghci> compileSc [("fib", Label "fib")] . head . parse $ p
You should specify the version 0.3.19, because the latest version is 0.3.18.
$ docker buildx build --load -t cutsea110/ifl:0.3.19 .
I suppose that you have some test programs for ifl in ${PWD}/examples
directory.
$ docker run -v ${PWD}/examples:/work -it --rm cutsea110/ifl:0.3.19 ifl -v -c pgmark1 /work/testProg80.ifl
or try this.
$ docker run -v ${PWD}/examples:/work -it --rm cutsea110/ifl:0.3.19 ifl -t 1000 -l -v -c timark6 /work/testProg134.ifl
Further more, just only on the TMark6, You can use -p option which profile your code.
$ docker run -v ${PWD}/examples:/work -it --rm cutsea110/ifl:0.3.19 ifl -t 1000 -l -v -c timark6 -p /work/testProg134.ifl
$ docker login
$ docker push cutsea110/ifl:0.3.19
You should update docker image version for next.