update to use new ast

soml was updated to have a typed ast layer to make programatic creation
easier
this brings LOTS of syntax change with it, that does not really mean
anything at all
All tests pass again so back to the same
This commit is contained in:
Torsten Ruger
2016-03-07 11:55:28 +02:00
parent d7b210d63a
commit 229f5896c6
22 changed files with 126 additions and 118 deletions

View File

@ -1,19 +1,19 @@
module Soml
Compiler.class_eval do
def on_assignment statement
def on_Assignment statement
reset_regs # statements reset registers, ie have all at their disposal
#puts statement.inspect
name , value = *statement
name = no_space name.to_a.first
v = process(value)
# name , value = *statement
name_s = no_space statement.name
v = process(statement.value)
raise "Not register #{v}" unless v.is_a?(Register::RegisterValue)
code = nil
if( index = @method.has_arg(name))
if( index = @method.has_arg(name_s.name))
# TODO, check type @method.arguments[index].type
code = Register.set_slot(statement , v , :message , Parfait::Message.get_indexed(index) )
else # or a local so it is in the frame
index = @method.has_local( name )
index = @method.has_local( name_s.name )
if(index)
# TODO, check type @method.locals[index].type
frame = use_reg(:Frame)