Skip to content

An example of a simple code formatter, written in Inko

License

Notifications You must be signed in to change notification settings

yorickpeterse/code-formatting-in-inko

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Code formatting in Inko

This repository showcases a basic code formatter written in Inko, based on Inko's own code formatting implementation, which in turn is based on Prettier, which in turn is based on the paper "A prettier printer" by Philip Wadler.

The implementation is well documented, and prior knowledge of Inko shouldn't be needed.

Requirements

  • Inko 0.15.0 or newer

Usage

Using Inko 0.15.0 or newer, run the program like so, where WIDTH is the desired line width:

inko run src/main.inko WIDTH

If you don't have or don't want to install Inko, you can also use Docker/Podman:

# When using Docker:
docker run --rm --volume ./src:/src:z ghcr.io/inko-lang/inko:latest inko run /src/main.inko WIDTH

# When using Podman:
podman run --rm --volume ./src:/src:z ghcr.io/inko-lang/inko:latest inko run /src/main.inko WIDTH

The output should be something along the lines of the following:

A screenshot of the expected output

The vertical grey line indicates the line limit.

License

The code in this repository is licensed under the Unlicense. A copy of this license can be found in the file "LICENSE".

About

An example of a simple code formatter, written in Inko

Topics

Resources

License

Stars

Watchers

Forks