Permalink
Browse files

+ With a simple driver, this outputs valid postscript

  • Loading branch information...
1 parent b00b329 commit 2723ab38d8bc75a7efd8af5fbcc4dc5d88e35f84 @kschiess committed Jan 2, 2011
Showing with 12 additions and 1 deletion.
  1. +8 −0 bin/wt
  2. +4 −1 lib/wt/ast.rb
View
8 bin/wt
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby
+
+$:.unshift File.dirname(__FILE__) + "/../lib"
+require 'wt'
+
+compiler = Wt::Compiler.new()
+p compiler.compile(ARGV.join(' '))
+
View
5 lib/wt/ast.rb
@@ -9,7 +9,10 @@ def compile
class Expression < Struct.new(:left, :op, :right)
OP_TABLE = {
- '+' => 'add'
+ '+' => 'add',
+ '-' => 'sub',
+ '*' => 'mul',
+ '/' => 'div',
}
def compile

0 comments on commit 2723ab3

Please sign in to comment.