Jim's
Tutorials

Spring 2019
course
site

I wrote up an implementation of PCF using the stack dynamics and the evaluation dynamics, including a unification-based typechecker and parsing/pretty-printing. Running the program gives a basic REPL for the evaluation dynamics; invoke it with -s to get the stack dynamics.

Dependencies are bound, deriving-compat, Earley, mtl, containers.

I've also uploaded a simple program that can calculate remainders. The REPL only takes one line at a time, so you'll have to flatten the file all into one line before putting it in. Performance is about as good as you might expect from an interpreter operating on unary nats with user-defined arithmetic—in GHC's interpreter mode, takes like 1 second to compute rem 1001 1000 in the evaluation dynamics and about 8 seconds in the stack dynamics. If the program is actually compiled, the performance is significantly better, but still terrible.

Jim's notes

https://cs.marlboro.college /cours /spring2019 /jims_tutorials /sarahr /midterm
last modified Wed May 1 2024 10:00 am

attachments [paper clip]

  last modified size
TXT PCF.hs Wed May 01 2024 10:00 am 15K
TXT rem.txt Wed May 01 2024 10:00 am 403B