Skip to content

Instantly share code, notes, and snippets.

View desireco's full-sized avatar
💭
Working /w AI on AI

Zeljko Dakic desireco

💭
Working /w AI on AI
View GitHub Profile

Keybase proof

I hereby claim:

  • I am desireco on github.
  • I am zdakic (https://keybase.io/zdakic) on keybase.
  • I have a public key ASBjhUyZZsv7NG8nSuRWoQSgqiHMvrnSc5HdufXX9ul7kAo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am desireco on github.
  • I am desireco (https://keybase.io/desireco) on keybase.
  • I have a public key ASBXULbWe44MpDjhRm4fKPAC5P0Dqv1wbTUqJk4Iotn9JAo

To claim this, I am signing this object:

@desireco
desireco / forth.rb
Created April 9, 2016 21:50 — forked from deadprogram/forth.rb
Forth interpreter in 64 lines of Ruby
#!/usr/bin/env ruby
def pop; $stack.pop || raise(StackUnderflow); end
def push(expression); $stack << expression; end
def unary; -> { push(yield pop) }; end
def binary; -> { push(yield pop, pop) }; end
def unary_boolean; -> { push(if yield pop then 1 else 0 end) }; end
def binary_boolean; -> { push(if yield pop, pop then 1 else 0 end) }; end
def swap; $stack[-2,2] = $stack[-2,2].reverse; end
$stack = []