diff --git a/lib/vm/README.markdown b/lib/neumann/README.markdown similarity index 98% rename from lib/vm/README.markdown rename to lib/neumann/README.markdown index 3ef77453..6c7c7c08 100644 --- a/lib/vm/README.markdown +++ b/lib/neumann/README.markdown @@ -1,4 +1,4 @@ -Virtual Machine +Von Neumann Machine =============== This is the logic that uses the generated ast to produce code, using the asm layer. diff --git a/lib/vm/block.rb b/lib/neumann/block.rb similarity index 100% rename from lib/vm/block.rb rename to lib/neumann/block.rb diff --git a/lib/vm/call_site.rb b/lib/neumann/call_site.rb similarity index 100% rename from lib/vm/call_site.rb rename to lib/neumann/call_site.rb diff --git a/lib/vm/code.rb b/lib/neumann/code.rb similarity index 100% rename from lib/vm/code.rb rename to lib/neumann/code.rb diff --git a/lib/vm/context.rb b/lib/neumann/context.rb similarity index 100% rename from lib/vm/context.rb rename to lib/neumann/context.rb diff --git a/lib/vm/function.rb b/lib/neumann/function.rb similarity index 100% rename from lib/vm/function.rb rename to lib/neumann/function.rb diff --git a/lib/vm/instruction.rb b/lib/neumann/instruction.rb similarity index 100% rename from lib/vm/instruction.rb rename to lib/neumann/instruction.rb diff --git a/lib/vm/passes.rb b/lib/neumann/passes.rb similarity index 100% rename from lib/vm/passes.rb rename to lib/neumann/passes.rb diff --git a/lib/vm/plock.rb b/lib/neumann/plock.rb similarity index 100% rename from lib/vm/plock.rb rename to lib/neumann/plock.rb diff --git a/lib/vm/register_machine.rb b/lib/neumann/register_machine.rb similarity index 100% rename from lib/vm/register_machine.rb rename to lib/neumann/register_machine.rb diff --git a/lib/vm/register_reference.rb b/lib/neumann/register_reference.rb similarity index 100% rename from lib/vm/register_reference.rb rename to lib/neumann/register_reference.rb diff --git a/lib/vm/values.rb b/lib/neumann/values.rb similarity index 100% rename from lib/vm/values.rb rename to lib/neumann/values.rb diff --git a/lib/ast/all.rb b/lib/old_ast/all.rb similarity index 100% rename from lib/ast/all.rb rename to lib/old_ast/all.rb diff --git a/lib/ast/basic_expressions.rb b/lib/old_ast/basic_expressions.rb similarity index 100% rename from lib/ast/basic_expressions.rb rename to lib/old_ast/basic_expressions.rb diff --git a/lib/ast/call_site_expression.rb b/lib/old_ast/call_site_expression.rb similarity index 100% rename from lib/ast/call_site_expression.rb rename to lib/old_ast/call_site_expression.rb diff --git a/lib/ast/compound_expressions.rb b/lib/old_ast/compound_expressions.rb similarity index 100% rename from lib/ast/compound_expressions.rb rename to lib/old_ast/compound_expressions.rb diff --git a/lib/ast/function_expression.rb b/lib/old_ast/function_expression.rb similarity index 100% rename from lib/ast/function_expression.rb rename to lib/old_ast/function_expression.rb diff --git a/lib/ast/if_expression.rb b/lib/old_ast/if_expression.rb similarity index 100% rename from lib/ast/if_expression.rb rename to lib/old_ast/if_expression.rb diff --git a/lib/ast/module_expression.rb b/lib/old_ast/module_expression.rb similarity index 100% rename from lib/ast/module_expression.rb rename to lib/old_ast/module_expression.rb diff --git a/lib/ast/operator_expressions.rb b/lib/old_ast/operator_expressions.rb similarity index 100% rename from lib/ast/operator_expressions.rb rename to lib/old_ast/operator_expressions.rb diff --git a/lib/ast/return_expression.rb b/lib/old_ast/return_expression.rb similarity index 100% rename from lib/ast/return_expression.rb rename to lib/old_ast/return_expression.rb diff --git a/lib/ast/while_expression.rb b/lib/old_ast/while_expression.rb similarity index 100% rename from lib/ast/while_expression.rb rename to lib/old_ast/while_expression.rb diff --git a/lib/vm/values/constants.rb b/lib/vm/constants.rb similarity index 100% rename from lib/vm/values/constants.rb rename to lib/vm/constants.rb diff --git a/lib/vm/values/integer.rb b/lib/vm/integer.rb similarity index 100% rename from lib/vm/values/integer.rb rename to lib/vm/integer.rb diff --git a/lib/vm/values/mystery.rb b/lib/vm/mystery.rb similarity index 100% rename from lib/vm/values/mystery.rb rename to lib/vm/mystery.rb diff --git a/lib/vm/object_machine.rb b/lib/vm/object_machine.rb new file mode 100644 index 00000000..da6e68aa --- /dev/null +++ b/lib/vm/object_machine.rb @@ -0,0 +1,33 @@ +module Vm + # The ObjectMachine is the object-oriented virtual machine in which ruby is implemented. + # + # It is minimal and realistic and low level + # - minimal means that if one thing can be implemented by another, it is left out. This is quite the opposite from + # ruby, which has several loops, many redundant if forms and the like. + # - realistic means it is easy to implement on a 32 bit machine (arm) and possibly 64 bit. Memory access, a stack, + # some registers of same size are the underlying hardware. (not ie byte machine) + # - low level means it's basic instructions are realively easily implemented in a register machine. ie send is not + # a an instruction but a function. + # + # A better name may be Value-based machine. Ie all "objects" are values, all passing is value based. + # The illusion of objects is created by a value called object-reference. + # + # So the memory model of the machine allows for indexed access into and "object" . A fixed number of objects exist + # (ie garbage collection is reclaming, not destroying and recreating) although there may be a way to increase that number. + # + # The ast is transformed to object-machine objects, some of which represent code, some data. + # + # The next step transforms to the register machine layer, which is what actually executes. + # + + # More concretely, an object machine is a sort of oo turing machine, it has a current instruction, executes the + # instructions, fetches the next one and so on. + # Off course the instructions are not soo simple, but in oo terms quite so. + # + # The machine has a no register, but local variables, a scope at each point in time. + # Scope changes with calls and blocks, but is saved at each level. In terms of lower level implementation this means + # that the the model is such that what is a variable in ruby, never ends up being just on the cpu stack. + # + class ObjectMachine + end +end diff --git a/lib/vm/values/reference.rb b/lib/vm/reference.rb similarity index 100% rename from lib/vm/values/reference.rb rename to lib/vm/reference.rb diff --git a/lib/vm/values/word.rb b/lib/vm/word.rb similarity index 100% rename from lib/vm/values/word.rb rename to lib/vm/word.rb