#! /usr/bin/env ruby require_relative '../lib/haxor' require 'optparse' parser = OptionParser.new do |opts| opts.banner = 'Usage: hcc [options] [file.hax]' opts.on_tail('-h', '--help', 'Show this message') do puts opts exit end opts.on_tail('-v', '--version', 'Show version') do puts "Haxor, version #{Haxor::Consts::GEM_VERSION}, version id #{Haxor::Consts::VERSION}." exit end end parser.parse! if ARGV.empty? puts 'You must specify .hax file to be compiled.' puts parser exit end source = File.absolute_path ARGV[0] compiler = Haxor::Compiler::Core.new compiler.register_unit Haxor::Compiler::Component::Arithmetic.new compiler.register_unit Haxor::Compiler::Component::Data.new compiler.register_unit Haxor::Compiler::Component::Jumps.new compiler.register_unit Haxor::Compiler::Component::Logical.new compiler.register_unit Haxor::Compiler::Component::Other.new compiler.register_unit Haxor::Compiler::Component::Transfer.new compiler.register_unit Haxor::Compiler::Component::Various.new compiler.compile source