PCF is simply typed lambda calculus + booleans + numbers + a few builtins + fix
.
acme-pcf
(courtesy of my boy @seagreen) is PCF + let + if/then/else + a real syntax, intended to be the RealWorld of language interpreters.
As of writing, my crack at it here cloc
s in at 340 lines of Clojure+instaparse+meander.
Going forward, I want to use this repo as a playground for different interpretation and compilation techniques.
See notes.md for more implementational geekery.
To facilitate testing against acme-pcf
's provided test harness, there are three steps involved.
In brief:
# in acme-pcf-specification/
> stack install
# then, in dang/
> clj -O:dang-socket # starts a repl, so maybe do this in a separate terminal tab or tmux pane
> acme-pcf-test run.sh
In more detail:
- Clone the original
acme-pcf
repo andstack install
to get theacme-pcf-test
executable. - Start up the socket server configured by the
:dang-server
alias indeps.edn
. This server just listens for TCP connections on port5575
and on connect reads one line of PCF from standard in, prints a result or error, and closes the connection. - Run the tests with the
run.sh
wrapper script.run.sh
implements the interface expected byacme-pcf-test
by calling up the socket server and parsing its answer. Convoluted and circuitous perhaps, but better than starting up and stopping the JVM in a for loop!