crystush

GitHub release Build Status

Interpreter for the Push 3 language (based on work by Lee Spector, Maarten Keijzer, Jon Klein, Chris Perry and Tom Helmuth, among others)

Installation

Add this to your application's shard.yml:

dependencies:
  crystush:
    github: shalmezad/crystush

Usage

require "crystush"

# Create a string with your program like so:
program_string = "( INTEGER.DUP INTEGER.+ )"

# Create a Crystush Program:
program = Crystush::Program.new(program_string)

# Optional: Create a preloaded stack
preload_stacks = Crystush::PushStacks.new
preload_stacks.integer_stack.push 4

# Evaluate the program:
stacks = program.evaluate(preload_stacks)

# Get the output from any of the stacks:
result = stacks.integer_stack.last

Contributing

  1. Fork it ( https://github.com/Shalmezad/crystush/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors