Skip to content

Online interactive parser and translator of EO and 𝜑-calculus

Notifications You must be signed in to change notification settings

fizruk/try-phi

 
 

Repository files navigation

Try 𝜑-calculus online: click here.

Demo

Try out these live examples:

  1. Factorial
  2. Factorial with user-defined fixpoint combinator
  3. Fibonacci numbers

This is an experimental interpreter for a variant of 𝜑-calculus. Right now we implement it as a term rewriting system with the following features (see formal rules):

  1. We support this syntax

    1. Objects: [x -> ^0.y, y -> [z -> ?]] (here ? stands for free attribute marker ø)
    2. Attributes: [y -> ^0.x].y.z
    3. Single named application: [x -> ?, @ -> ^0.x](x -> ^0.y) (@ stand for 𝜑 attribute)
  2. By default, the interpreter will try to immediately parse and dataize an expression written in the editor.

  3. If dataization fails, it will nevertheless show original term and its weak head normal form (after last reduction step).

  4. At the moment, infinite recursion can hang the page and editor, — simply reload the page!

How to contribute

  • Clone this repository

    git clone --recurse-submodules -j8 https://github.com/br4ch1st0chr0n3/try-phi
    cd try-phi
  • Install Node.js

  • Install codemirror dependencies

    npm --prefix codemirror i
  • Install nix

VS Code

  • Install VS Code

  • Open it in try-phi folder

    code .
  • Open terminal in VS Code (Ctrl+ `)

  • Install stack

  • Build project. Also, use this command to rebuild the project

    sh build.sh
  • Install Haskell extension. It will enable linter and documentation on hover

  • Open app/Main.hs and hover onto a function and check if docs appear

  • Open index.html in browser, e.g.:

    firefox index.html
    • In case nothing changes, clear browser cache
  • Optionally, the extension stylish-hindent for formatting the code

  • Use Nix Environment Selector

  • If typechecking doesn't work, reload VS Code

  • You can see Haskell code's output at localhost:8080/ after

    stack run

About

Online interactive parser and translator of EO and 𝜑-calculus

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Haskell 93.4%
  • CSS 2.6%
  • Nix 2.3%
  • JavaScript 1.2%
  • Other 0.5%