Skip to content
/ SKIio Public

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

License

Notifications You must be signed in to change notification settings

JuliaPoo/SKIio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages