Module: SpecialGiggle
Defined Under Namespace
Classes: GiggleError
Constant Summary collapse
- VERSION =
"1.0.0"
Constants included from Generator
Generator::BinaryOps, Generator::UnaryOps, Generator::Vars
Constants included from Parser
Parser::BinaryOps, Parser::UnaryOps
Constants included from Lexer
Class Method Summary collapse
Methods included from Generator
generate, generate_expression, generate_statement, var_temp
Methods included from Parser
parse, parse_expression, parse_statement
Methods included from Lexer
Class Method Details
.compile(infile, outfile, tmpdir = "/tmp") ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/special-giggle.rb', line 19 def self.compile(infile, outfile, tmpdir = "/tmp") raise GiggleError, "Input file #{infile} does not found." unless File.exist?(infile) file = File.basename(infile, ".*") sfile, ofile = File.("#{file}.s", tmpdir), File.("#{file}.o", tmpdir) File.write(sfile, to_asm(File.read(infile))) system("as --64 -o #{ofile} #{sfile}") || (raise GiggleError, "Can't compile with as") system("gcc -no-pie -o #{outfile} #{ofile}") || (raise GiggleError, "Can't link with gcc") end |