Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seagreen/acme-pcf-specification
https://github.com/seagreen/acme-pcf-specification
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/seagreen/acme-pcf-specification
- Owner: seagreen
- License: bsd-3-clause
- Created: 2019-12-17T18:44:34.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-03-30T19:14:03.000Z (over 2 years ago)
- Last Synced: 2024-11-02T14:42:32.615Z (about 2 months ago)
- Language: Haskell
- Size: 116 KB
- Stars: 13
- Watchers: 6
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Acme PCF Specification
## The Problem
[RealWorld](https://github.com/gothinkster/realworld) is a fantastic tool for comparing programming languages, but I'm not very interested in HTTP APIs.
## The Solution
Make RealWorld-like specifications for more things than webapps.
In this case, a tiny programming language called PCF.
## Why PCF
PCF is "Programming Computable Functions", a language by [Gordon Plotkin](https://en.wikipedia.org/wiki/Gordon_Plotkin). He introduced it in a 1977 paper called [LCF Considered as a Programming Language](https://homepages.inf.ed.ac.uk/gdp/publications/LCF.pdf).
It's simply typed lambda calculus with a few extensions. These are a builtin `fix` function for recursion, primitive booleans and natural numbers with a handful of operations on them, and if/then/else statements.
This is perfect for our purposes. It's enough features to make implementations exert themselves, but still few enough that it stays a small project.
## Example
Plotkin doesn't give the langauge a concrete syntax, so we make one up. You can find the details (as well as instructions for writing your own implementation) in [./spec](./spec).
Input:
```
let
add =
fix
(\recurse : Nat -> Nat -> Nat.
\x : Nat. \y : Nat.
if is-zero x
then
yelse
recurse (pred x) (suc y))
in
add 3 4
```Output:
```
7
```## Implementations
+ [./impl](./impl): The reference implementation.
+ [dang](https://github.com/xilnocas/dang): A Clojure implementation by [Nick Lawler](https://github.com/xilnocas).
## Special thanks
This [delightful article](https://jozefg.bitbucket.io/posts/2015-03-24-pcf.html) by Daniel Gratzer ([GitHub repo link](https://github.com/jozefg/pcf)) introduced me to PCF, though he implements different builtins than Plotkin.