From e0c1cb48fdf6a4566a58de2678ac039210a1d3b6 Mon Sep 17 00:00:00 2001 From: "MATSUMOTO, Katsuyoshi" Date: Mon, 22 May 2023 09:09:30 +0900 Subject: [PATCH] add interface for to_elf --- lib/vaporware/compiler/assemble.rb | 17 +++++++++++++++++ sig/vaporware.rbs | 13 +++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 lib/vaporware/compiler/assemble.rb diff --git a/lib/vaporware/compiler/assemble.rb b/lib/vaporware/compiler/assemble.rb new file mode 100644 index 0000000..ea28ca1 --- /dev/null +++ b/lib/vaporware/compiler/assemble.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Vaporware + class Compiler::Assemble + attr_reader :input, :output + def self.compile!(input, output = File.basename(input, ".*")) = new(input, output).compile + + def initialize(input, output = File.basename(input, ".*")) + @input, @output = input, output + @target_file = File.open(output, "wb") + end + + def compile(compile_options = []) + self + end + end +end diff --git a/sig/vaporware.rbs b/sig/vaporware.rbs index bece5aa..7b3cdfa 100644 --- a/sig/vaporware.rbs +++ b/sig/vaporware.rbs @@ -10,6 +10,19 @@ module Vaporware @generator: Vaporware::Compiler::Generator # instance methods def compile: (?compiler: String, ?compiler_options: Array[String]) -> nil + + class Assemble + @input: String + @output: String + @target_file: File + # class methods + def self.compile!: (String, ?String) -> Vaporware::Compiler::Assemble + def initialize: (String, ?String) -> untyped + + # instance methods + def compile: (?Array[String]) -> self + end + class Generator REGISTER: Array[String] # instance variables