Skip to content

nicklawls/dang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dang, an acme-pcf in Clojure

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.

Run and Test

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:

  1. Clone the original acme-pcf repo and stack install to get the acme-pcf-test executable.
  2. Start up the socket server configured by the :dang-server alias in deps.edn. This server just listens for TCP connections on port 5575 and on connect reads one line of PCF from standard in, prints a result or error, and closes the connection.
  3. Run the tests with the run.sh wrapper script. run.sh implements the interface expected by acme-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!

About

Acme PCF in clojure

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published