sorting mom instructions and statements into separate dirs

This commit is contained in:
Torsten Ruger 2018-03-13 16:51:33 +05:30
parent 2779045caa
commit 20a88f9ac8
17 changed files with 21 additions and 19 deletions

View File

@ -1,6 +1,6 @@
# The *essential* step from vool to risc, is the one from a language to a machine. From statements
# that hang in the air, to an instruction set.
#
#
# ### Tree based: So almost 1-1 from vool
#
# ### Use object memory : object to object transfer + no registers
@ -14,4 +14,5 @@
module Mom
end
require_relative "mom/instruction.rb"
require_relative "mom/instruction/instruction.rb"
require_relative "mom/statement/statement.rb"

View File

@ -62,7 +62,7 @@ To make the transition even easier, it is done in two steps.
## 1. Everything but control structures
So we go from language to machine as the first step, in terms of memory instructions.
wSo we go from language to machine as the first step, in terms of memory instructions.
Memory gets moved around between the main machine objects (frames and messages).
But control structures stay "intact", so we stay at tree structure
@ -77,4 +77,4 @@ After this, it is quite trivial to translate to risc, as it mostly expands instr
I hope that in the future this simple 2 stage pipeline will expand into more steps.
This is the ideal layer to do code analysis and meaningful optimisations, as one can still
understand what is going on in higher terms.
understand what is going on in higher terms.

View File

@ -17,7 +17,7 @@ module Mom
@name = name
end
def to_risc(compiler)
Risc::Label.new(self,name)
Risc::Label.new(self,name)
end
end
end
@ -32,4 +32,3 @@ require_relative "slot_load"
require_relative "return_sequence"
require_relative "message_setup"
require_relative "argument_transfer"
require_relative "statement"

View File

@ -0,0 +1,15 @@
module Mom
class Statement
include Common::List
# flattening will change the structure from a tree to a linked list (and use
# nekst to do so)
def flatten(options = {})
raise "not implemented for #{self}"
end
end
end
require_relative "statements"
require_relative "if_statement"
require_relative "while_statement"

View File

@ -1,13 +1,4 @@
module Mom
class Statement
include Common::List
# flattening will change the structure from a tree to a linked list (and use
# nekst to do so)
def flatten(options = {})
raise "not implemented for #{self}"
end
end
class Statements < Statement
include Common::Statements
@ -26,8 +17,4 @@ module Mom
}
end
end
end
require_relative "if_statement"
require_relative "while_statement"