Permalink
Browse files

Executable file

  • Loading branch information...
1 parent 3b9dbcc commit b53f25cfdbe71fc76e2108878aaf825395d082e8 @txus committed Mar 10, 2011
Showing with 33 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +32 −0 bin/schemer
View
@@ -0,0 +1 @@
+*.gem
View
@@ -0,0 +1,32 @@
+#!/usr/bin/env ruby
+require 'schemer'
+require 'pp'
+
+lexer = Schemer::Lexer.new
+parser = Schemer::Parser.new
+
+DEBUG = false
+if ARGV[1] == '-d' || ARGV[1] == '--debug'
+ DEBUG = true
+end
+code = File.read(ARGV.first)
+
+tokens = lexer.parse(code)
+if DEBUG
+ puts "-----LEXER-----"
+ pp tokens
+end
+
+parsed = parser.apply(tokens)
+if DEBUG
+ puts "-----PARSER-----"
+ pp parsed
+end
+
+interpreter = Schemer::Interpreter.new(parsed)
+
+result = interpreter.walk
+if DEBUG
+ puts "-----OUTPUT-----"
+ pp result
+end

0 comments on commit b53f25c

Please sign in to comment.