bin/p-lang in p-lang-0.0.3 vs bin/p-lang in p-lang-0.0.4
- old
+ new
@@ -3,11 +3,14 @@
require File.join(File.expand_path(File.dirname(__FILE__)), '/../lib/p-lang')
if ARGV[0]
@parser = PLangParser.new
- ast = @parser.parse(File.readlines(ARGV[0]).join("")).build.collect(&:to_sexp)
-
- vm = PLang::VM.new(ast)
-
- vm.execute!
-end
\ No newline at end of file
+ ast = @parser.parse(File.readlines(ARGV[0]).join(""))
+
+ if ast
+ vm = PLang::VM.new(ast.build.collect(&:to_sexp))
+ vm.execute!
+ else
+ puts @parser.failure_reason
+ end
+end