diff options
| author | Arnaud Bailly <arnaud.bailly@iohk.io> | 2025-01-25 10:45:41 +0100 |
|---|---|---|
| committer | Arnaud Bailly <arnaud.bailly@iohk.io> | 2025-01-25 10:45:41 +0100 |
| commit | 7752d73216578d5961751b5d0535088d384b4aa6 (patch) | |
| tree | 786e46fe1276e93ade0a48398cd4c9ac13081707 /lambda-calcul/rust/README.md | |
| parent | d6f68e919db51d366c8ca3c1509bea12aa81d692 (diff) | |
| download | lambda-nantes-7752d73216578d5961751b5d0535088d384b4aa6.tar.gz | |
Move λ-calcul workshop code to subdirectory
Diffstat (limited to 'lambda-calcul/rust/README.md')
| -rw-r--r-- | lambda-calcul/rust/README.md | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/lambda-calcul/rust/README.md b/lambda-calcul/rust/README.md new file mode 100644 index 0000000..7dfc03b --- /dev/null +++ b/lambda-calcul/rust/README.md @@ -0,0 +1,42 @@ +# Rust λ-calcul reference implementation + +This directory contains a reference implementation of a normal order semantics λ-calculus based language. +Current syntax is based on S-expressions, ie. Lisp. There is a command-line interpreter for batch and interactive evaluation of input, and an embryonic tester daemon. + +# Tester + +The tester daemon is inspired by [Extreme Startup](https://github.com/rchatley/extreme_startup): It's a REST-ish server and client that allows to repeatedly send λ-terms to a remote execution engine and compare the result against its expectations. + +The interaction flow is simple: + +* HTTP server starts on some known port (eg. 8080) +* Client sends a `POST /register` request, passing in as payload a JSON object with a `url` and `name` string fields + ``` + curl -v -X POST -d '{"url":"http://127.0.0.1:8888/eval", "name": "toto"}' -H 'Content-type: application/json' http://localhost:8080/register + ``` +* Obviously, client needs to start a HTTP server able to respond to a `GET` request at the given URL +* If URL is not already registered, server accepts the registration (returning a 200 result) and starts a _testing thread_ +* The _tester_ then repeatedly sends `POST` requests to the client's registered URL + * The body of the request is plain text S-expression representing a λ-term + * The tester expects the response to be the plain text result of the evaluation of those terms +* If the client fails to answer, or answers wrongly, the server keeps sending the same request +* If the client's answer is correct, the server sends another term to evaluate and awards 1 point to the client +* The `/leaderboard` endpoint provides a crude HTML page listing each clients' current score + +## Building + +This software is written in Rust (sorry @xvdw), so one needs a Rust toolchain installed, then: + +``` +cargo build && cargo test +``` + +## Running + +To run the server: + +``` +cargo run --bin server +``` + +There are `--port` and `--host` arguments should one want to change the defaults `127.0.0.1:8080` |
