Skip to content
A cool Whitespace language implementation in Ruby.
Ruby Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Remove GPL code Apr 28, 2019
.gitignore Add documentation of ruby2ws, and add akaza command May 3, 2019
Gemfile bunlde gem Apr 28, 2019
LICENSE Update metadatas Jan 18, 2020 Update documentation May 3, 2019
Rakefile Implement VM and Parser Apr 28, 2019
akaza.gemspec Update metadata Jan 18, 2020


A cool Whitespace language implementation in Ruby.


Add this line to your application's Gemfile:

gem 'akaza'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install akaza


  • RUBY_VERSION > '2.6'
    • It needs pattern match feature.

Basic Usage

require 'akaza'

# It use $stdin and $stdout

# Use other IO
input =
output =
Akaza.eval(whitespace_code, input: input, output: output)

You can find example Whitespace programs from test/fixtures/ directory.

Cool Usage

The basic usage is good, but it is not fun. Akaza provides really "cool" interface to define a method with Whitespace. You can write Whitespace in Ruby program directly!

For example:

require 'akaza'

class A
  extend Akaza::Annotation

  whitespace def sum(a, b)


a =
p a.sum(20, 22) # => 42

Cool! You no longer need to write Whitespace as a string literal. You can write Whitespace in Ruby seamlessly. It is elegant!

Requirements of cool style

  • Space, tab and newline in method body are evaluated as Whitespace program.
    • Other characters are ignored for Whitespace, but they are evaluated as Ruby program.
  • Akaza::Body is replaced with Whitespace code.
  • input and output variables are necessary. They are IO.

Akaza provides a shorthand. If Akaza::Body is omitted, the method only evaluates Whitespace program. The method receives input and output.

For example:

require 'akaza'

class A
  extend Akaza::Annotation

  whitespace def sum(input, output)

This	code is never evaluated.	

So you can write any
sentences as comments!  

a =
input ="20\n22\n")
output =
a.sum(input, output)
p output.string # => "42"

Convert Ruby to Whitespace

You can convert Ruby to Whitespace. It is an easy way to write Whitespace.



After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to


Bug reports and pull requests are welcome on GitHub at

You can’t perform that action at this time.