• R/O
  • HTTP
  • SSH
  • HTTPS

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

A categorical programming language


File Info

修訂. 06d54b6826960957451cbd73a9f8ab2602805f66
大小 1,907 bytes
時間 2024-11-25 06:23:56
作者 Corbin
Log Message

Allow pairing of domains.

I'm so pissed that I couldn't do this in a nice generic fashion. This
works, but it's ugly and verbose.

Content

# Cammy

"[Cammy is] really not a good language for anything." ~ [Me](https://lobste.rs/s/ftqp21/whatever_happened_elm_anyway#c_8fnjr6)

## Introduction

Cammy is a simple syntax for bicartesian closed categories with natural
numbers objects. It directly represents arrows with S-expressions. This
toolchain also includes support for IEEE 754 floating-point numbers.

### jelly

The `jelly` tool reads Cammy expressions and emits equivalent Cammy
expressions which are usually smaller, sometimes more accurate if using
floating-point maths, and sometimes more generic.

### bk

The `bk` tool encodes Cammy expressions into git repositories. When we use git
in this fashion, we obtain Cammy hives, a content-addressable and scalable
system for managing Cammy expressions.

## Toolchain maintenance

### How to add new primitives/jets

* Jet definitions in jets.json
* New primitive arrows in prims.json
* CAM operations in cammylib/cam.py
* Parser/compiler to CAM in cammylib/arrows.py
* Typechecker in cammyo.scm
* Interpreters in cammyo.scm and cammy.scm
* Algebraic laws (optimizations, jet introduction) in jelly/src/main.rs

### Jelly

The jelly optimizer is a Cammy-to-Cammy optimizer which uses e-graphs to
search for the smallest equivalent expression. The rule engine is from the
`egg` library. The rules are written in a DSL embedded in Rust, along with
comments explaining their provenance and correctness.

To update Cargo dependencies for jelly:

    $ ./update-jelly.sh

### Shell Environment

The environment for developing the Cammy toolchain is contained within
`shell.nix`.

To update eggs for the shell environment:

    $ egg2nix eggs.scm > eggs.nix

### Compiling to Categories

The second argument to cammy-frame applies a list of functors. Each functor
corresponds to a path in the hive; functor `foo` corresponds to `cats/foo/`.
The list is comma-separated and applied left-to-right.