Skip to main content

An esolang that extends SKI combinators with I/O. Interpreter and Compiler from lambda expressions implemented

Project description

SKIio

This repository implements an interpreter for SKIio and a compiler from a higher level language Purr to SKIio. A description of Purr can be found below.

SKIio is an extremely minimal programming language that's an extension of SKI Combinator Calculus for I/O. Here's what it looks like:

; Repeat forever: Read and print a byte of user input
S(K(S(S(S)(K(S(K(S(K(S(S(K(o))(i))))))(S(K(S(S)(K(K))))
(S(K(K))(S(K(S(S)))(K)))))))(K(S(S(K(S))(K))))))(S(K(K)
)(S(S)(K(K(K(I))))))(S(S(K(S(S)(K(S(I)(I)))))(K))(S(K(S
(S)(K(S(I)(I)))))(K)))

SKIio consists of 5 combinators: S, K, I, as defined in the original SKI Combinator Calculus, and i and o, which does input and output.

  • i(x): Reads a byte of input at index x
    • x is a church encoded integer
    • Returns a church encoded integer
  • o(x): Prints the byte x
    • x is a church encoded integer
    • Returns I.

E.g. The program o(i(K(I))) reads a byte of user input and prints it.

To see the Purr spec read PURR.md.

To see the SKIio spec read SKIIO.md

For more information about how SKIio and Purr is implemented, see DETAILS.md

Quickstart

Installation

pip install skiio

Running

You could write an SKIio program in a file, say test.ski, and run it with:

python -m skiio run -i test.ski

You could also write a Purr program in a file, say test.purr, and compile it:

python -m skiio compile -i test.purr -o test
python -m skiio run -i test.ski

More options (e.g. optimizations, debugging) can be found with

python -m skiio -h

Full usage:

usage: SKIio [-h] {compile,c,run,r} ...

SKIio interpreter and compiler, command-line interface

positional arguments:
  {compile,c,run,r}  Action
    compile (c)      Compile Purr code
    run (r)          Run SKIio code

optional arguments:
  -h, --help         show this help message and exit  


usage: SKIio {compile, c} [-h] -i INFILE -o OUTFILE [-opt OPTIMIZE] [-m INTERMEDIATE]

optional arguments:
  -h, --help            show this help message and exit
  -i INFILE, --infile INFILE
                        Input filename with Purr code
  -o OUTFILE, --outfile OUTFILE
                        Output filename (without extension)
  -opt OPTIMIZE, --optimize OPTIMIZE
                        Toggle off optimization (default: True)
  -m INTERMEDIATE, --intermediate INTERMEDIATE
                        Output intermediate representation (default: False)     

usage: SKIio {run, r} [-h] -i INFILE [-v] [-vv]

optional arguments:
  -h, --help            show this help message and exit
  -i INFILE, --infile INFILE
                        Input filename with SKIio code
  -v, --verbose         Prints debugging info (default: None)
  -vv, --veryverbose    Steps through execution (default: None)

Examples

Examples can be found in the examples folder

Purr:

SKIio:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

skiio-1.0.2-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file skiio-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: skiio-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.3 Windows/10

File hashes

Hashes for skiio-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bbe0fafa362d3c3cfb77cadccc3d1128117d8b8f3feb0112b7bc7876ff5fdf69
MD5 fd5f0d53fa26e4b80959df177ad0a304
BLAKE2b-256 13b9caf612a4eafa7a4e95529b3e501a7eff5f4dd0caad956a061aed3012726d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page