{"id":20929386,"url":"https://github.com/cognitive-engineering-lab/document-calculus","last_synced_at":"2025-05-13T18:32:25.797Z","repository":{"id":198349375,"uuid":"664442395","full_name":"cognitive-engineering-lab/document-calculus","owner":"cognitive-engineering-lab","description":"Accompanying materials for \"A Core Calculus for Documents\"","archived":false,"fork":false,"pushed_at":"2023-10-05T03:41:26.000Z","size":67,"stargazers_count":31,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T06:12:29.369Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cognitive-engineering-lab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-10T01:43:36.000Z","updated_at":"2024-08-15T17:15:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"b31b2c1e-95cf-4c0f-82d7-078507c2e94c","html_url":"https://github.com/cognitive-engineering-lab/document-calculus","commit_stats":null,"previous_names":["cognitive-engineering-lab/document-calculus"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cognitive-engineering-lab%2Fdocument-calculus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cognitive-engineering-lab%2Fdocument-calculus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cognitive-engineering-lab%2Fdocument-calculus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cognitive-engineering-lab%2Fdocument-calculus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cognitive-engineering-lab","download_url":"https://codeload.github.com/cognitive-engineering-lab/document-calculus/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254003380,"owners_count":21997876,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T21:19:14.644Z","updated_at":"2025-05-13T18:32:25.504Z","avatar_url":"https://github.com/cognitive-engineering-lab.png","language":"OCaml","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A Core Calculus for Documents\n\nThis repository contains the accompanying artifact for the POPL'24 paper \"A Core Calculus for Documents\" (Crichton and Krishnamurthi). \n\n## Overview\n\nThe core contribution of our paper is a formal model of document languages. This model extends System F with the concept of templates. We provide static and dynamic semantics for templates, and we also model various run-time extensions to the system such as reference labeling and reactivity.\n\nThis artifact implements each aspect of the model in OCaml. Our main goal in the implementation is to *correctly* and *clearly* implement the model. Then this model can facilitate authors of document languages to pick and choose ideas that are relevant to their setting, especially those less familiar with PL theory notation. Each of the source files has been liberally commented to explain the purpose of the code, and to point a reader to the relevant pieces.\n\n**Claims:** Sections 3, 4, and 5 all contain elements that are implemented in the artifact. See \"Evaluation Instructions\" below for details on which modules correspond to which subsections.\n\n## Getting Started\n\n### From Docker\n\nIf you are downloading a Docker image from Zenodo, first: make sure to pick the image that corresponds to your architecture. That's `arm64` for an ARM machine (e.g., an M-series Mac), and `amd64` otherwise.\n\nThen run the following command, replacing `\u003cARCH\u003e` with either `arm64` or `amd64`:\n\n```\ndocker load -i document-calculus-popl24-\u003cARCH\u003e.tar.gz\n```\n\nThen start the image and run the tests as follows:\n\n```\n$ docker run -ti document-calculus-popl24:\u003cARCH\u003e bash\nopam@4fb288bee717:/app$ opam exec -- dune test\n```\n\n### From Source\n\n#### I'm in a hurry\n\nYou need [opam]. Run this script:\n\n```\nopam switch create 4.13.1 --yes\neval $(opam env --switch=4.13.1)\nopam install . --deps-only --locked --yes\nopam exec -- dune test\n```\n\n#### I have some time\n\nIn greater detail: first, you need the OCaml package manager [opam]. This artifact was last tested with opam version 2.1.3.\n\nThen, you need OCaml. This artifact was last tested with OCaml version 4.13.1. You can install the version by running:\n\n```\nopam switch create 4.13.1\n```\n\nThen install the project's dependencies by running:\n\n```\nopam install . --deps-only --locked\n```\n\nFinally, make sure the tests pass by running:\n\n```\nopam exec -- dune test\n```\n\n## Evaluation Instructions\n\nTo evaluate this artifact, you should check that the paper representation of the model matches the OCaml representation of the model. I recommend doing so in the following order:\n\n* Section 3.1.1: the `DStrLit` module in `lib/string.ml`.\n* Section 3.1.2: the `DStrProg` module in `lib/string.ml`.\n* Section 3.1.3: the `DStrTLit` module in `lib/string.ml`.\n* Section 3.1.4: the `DStrTProg` module in `lib/string.ml`.\n* Section 3.2.1: has no implementation in the code.\n* Section 3.2.2: the `DArtProg` module in `lib/article.ml`.\n* Section 3.2.3: has no implementation in the code.\n* Section 3.2.4: the `DArtTProg` module and the `DArtTProgNested` module in `lib/article.ml`, and the `Node` module in `lib/extensions.ml`.\n* Section 4.1: the `References` module in `lib/extensions.ml`.\n* Section 4.2: the `Reforestation` module in `lib/extensions.ml`.\n* Section 4.3: the `Reactivity` module in `lib/extensions.ml`.\n* Section 5.1: the `typecheck_template` functions in `lib/string.ml` and `lib/article.ml`.\n\n## Additional Artifact Details\n\nThe main source files are all in `lib/`. The other files correspond to these categories:\n\n### Tests\n\nTo test that the artifact has no basic errors, we have written a number of unit tests in `test/tests.ml`. You can run these tests with the following command:\n\n```\nopam exec -- dune test\n```\n\nYou can also edit `tests.ml` and add your own test if you want.\n\n### Playground\n\nWe have provided a `bin/main.ml` file for playing around with the library. \nThere is already a sample program there you can run, like this:\n\n```\n$ opam exec -- dune exec bin/main.exe\nA sample program:\n  \"hello\" + \" world\"\n\nIt evaluates to:\n  \"hello world\"\n```\n\nYou can try modifying `main.ml` and rerunning it with different programs.\n\n[opam]: https://opam.ocaml.org/doc/Install.html","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcognitive-engineering-lab%2Fdocument-calculus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcognitive-engineering-lab%2Fdocument-calculus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcognitive-engineering-lab%2Fdocument-calculus/lists"}