Skip to content

Erlang implementation of an interpreter for the Whitespace esoteric programming language

License

Notifications You must be signed in to change notification settings

derek121/mrwhite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mr. White

Erlang Interpreter for the Whitespace Language

Whitespace is an imperative, stack-based language whose only significant characters are space, tab, and linefeed. Operations consists of an instruction type followed by the command. The interpreter maintains a stack of integers and a heap.

Besides the execution of Whitespace programs, this application also supports execution of, and conversion between, a textual format that makes it easier to understand what the program is doing.

For example, pushing a value of 5 onto the stack in Whitespace is coded as SSSTSTL, where S, T, and L represent a space, tab, and linefeed, respectively. This can be seen by the following:

1> W = mrwhite_from_text:convert("stack push 5", return).
"   \t \t\n"
2> mrwhite_from_whitespace:convert(W, return).
"stack push 5\n"

The canonical example at the Whitespace page mentioned above, which can be found in priv/sample/canonical.ws and priv/sample/canonical.wst, illustrates a number of the operations supported by the language, and can be run as follows.

3> mrwhite_from_whitespace:run({file_in, "priv/sample/canonical.ws"}).
1
2
3
4
5
6
7
8
9
10
ok

Building

$ make will run the lexing and parsing steps, move the generated Erlang modules to src/, compile, and run Eunit tests.

Presentation

Mr. White was presented in a lightning talk at Erlang & Elixir Factory SF Bay Area 2017 (slides) (video)

About

Erlang implementation of an interpreter for the Whitespace esoteric programming language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published