crystush
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
- Fork it ( https://github.com/Shalmezad/crystush/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- Shalmezad Richard Wardin - creator, maintainer