2017-04-10 11:47:18 +03:00
|
|
|
module Mom
|
|
|
|
|
|
|
|
# Base class for MOM instructions
|
|
|
|
class Instruction
|
2017-09-08 13:10:22 +03:00
|
|
|
include Common::List
|
2017-09-04 21:00:08 +03:00
|
|
|
|
2018-03-17 11:13:44 +05:30
|
|
|
def to_risc(m)
|
|
|
|
Risc::Label.new(self.class.name, self.class.name + "_todo")
|
|
|
|
end
|
2017-04-10 11:47:18 +03:00
|
|
|
end
|
|
|
|
|
2017-09-04 21:00:08 +03:00
|
|
|
# A label with a name
|
2017-09-08 13:10:22 +03:00
|
|
|
class Label < Instruction
|
2017-08-30 17:21:13 +03:00
|
|
|
attr_reader :name
|
|
|
|
def initialize(name)
|
|
|
|
@name = name
|
|
|
|
end
|
2018-03-13 16:16:06 +05:30
|
|
|
def to_risc(compiler)
|
2018-03-13 16:51:33 +05:30
|
|
|
Risc::Label.new(self,name)
|
2018-03-13 16:16:06 +05:30
|
|
|
end
|
2017-08-30 17:21:13 +03:00
|
|
|
end
|
2017-04-10 11:47:18 +03:00
|
|
|
end
|
2017-04-12 11:53:02 +03:00
|
|
|
|
2018-03-13 12:30:51 +05:30
|
|
|
require_relative "basic_values"
|
2017-04-15 20:58:39 +03:00
|
|
|
require_relative "simple_call"
|
2017-09-14 16:07:02 +03:00
|
|
|
require_relative "dynamic_call"
|
2017-08-30 17:21:13 +03:00
|
|
|
require_relative "truth_check"
|
2017-09-14 16:07:02 +03:00
|
|
|
require_relative "not_same_check"
|
2017-08-30 17:21:13 +03:00
|
|
|
require_relative "jump"
|
2017-04-12 11:53:02 +03:00
|
|
|
require_relative "slot_load"
|
2017-04-14 21:01:50 +03:00
|
|
|
require_relative "return_sequence"
|
2017-09-11 14:22:33 +03:00
|
|
|
require_relative "message_setup"
|
|
|
|
require_relative "argument_transfer"
|