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 clocs 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.shIn more detail:
- Clone the original acme-pcfrepo andstack installto get theacme-pcf-testexecutable.
- Start up the socket server configured by the :dang-serveralias indeps.edn. This server just listens for TCP connections on port5575and 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.shwrapper script.run.shimplements the interface expected byacme-pcf-testby 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!