Skip to content

progbits/spacebar

Repository files navigation

Spacebar

A C to Whitespace transpiler.

Getting Started

Spacebar is written in OCaml, instructions on how to install OCaml for your operating system can be found in the offical documentation.

Spacebar uses the Dune build system. Instructions on installing Dune can be found in the project documentation.

Once you have installed OCaml and Dune, the project can be built by running

dune build

Once built, the spacebar.exe build artifact can be found in the _build/default directory.

Usage

Spacebar reads C code from stdin and outputs transpiled Whitespace code to stdout. For example, to transpile one of the examples in the functional test suite to a file called out.ws:

cat test/basic_main.c | ./_build/default/spacebar.exe > out.ws

Testing

A Bats based functional test suite is provided in the test directory. By default the test suite expects an existing Whitespace interpreter on the path with the name wspace. The Spacebar binary used for testing is sourced from the default build directory (_build/default/).

To run the test suite:

./test/functional.sh