update for yielding
wip
This commit is contained in:
parent
11cdb5872a
commit
bba8f787d5
@ -25,11 +25,12 @@ body
|
|||||||
width: 16%
|
width: 16%
|
||||||
margin-left: 1%
|
margin-left: 1%
|
||||||
overflow-x: hidden
|
overflow-x: hidden
|
||||||
|
|
||||||
.risc_view
|
.risc_view
|
||||||
width: 34%
|
width: 34%
|
||||||
margin-left: 1%
|
margin-left: 1%
|
||||||
|
overflow-x: hidden
|
||||||
|
|
||||||
.status_view
|
.status_view
|
||||||
width: 14%
|
width: 14%
|
||||||
margin-left: 1%
|
margin-left: 1%
|
||||||
|
@ -55,6 +55,7 @@ class SelectView < ElementView
|
|||||||
@element.at_css(".code_list") << list
|
@element.at_css(".code_list") << list
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def select( code )
|
def select( code )
|
||||||
puts "selecting #{code}"
|
puts "selecting #{code}"
|
||||||
@interpreter.set_state :stopped
|
@interpreter.set_state :stopped
|
||||||
@ -64,13 +65,14 @@ class SelectView < ElementView
|
|||||||
@interpreter.start_program(linker)
|
@interpreter.start_program(linker)
|
||||||
end
|
end
|
||||||
def as_main(statements)
|
def as_main(statements)
|
||||||
"class Space ;def main(arg) ; #{statements}; end; end"
|
"class Space ;def yielder; return yield ; end;def main(arg) ; #{statements}; end; end"
|
||||||
end
|
end
|
||||||
def get_codes
|
def get_codes
|
||||||
{ while_with_calls: 'a = 0; while( 0 > a); a = 1 + a;end;return a',
|
{ while_with_calls: 'a = 0; while( 0 > a); a = 1 + a;end;return a',
|
||||||
set_internal_byte: "return 'Hello'.set_internal_byte(1,75)" ,
|
set_internal_byte: "return 'Hello'.set_internal_byte(1,75)" ,
|
||||||
called_if: 'if( 10 ); return "then";else;return "else";end' ,
|
called_if: 'if( 10 ); return "then";else;return "else";end' ,
|
||||||
plus: 'return 5 + 7' ,
|
plus: 'return 5 + 7' ,
|
||||||
|
yield: "a = yielder {return 15} ; return a" ,
|
||||||
return: 'return 5' ,
|
return: 'return 5' ,
|
||||||
hello_world: "h = 'Hello World'.putstring;return h",
|
hello_world: "h = 'Hello World'.putstring;return h",
|
||||||
dynamic_call: "a = 150 ; return a.div10",
|
dynamic_call: "a = 150 ; return a.div10",
|
||||||
|
@ -36,7 +36,7 @@ class RiscView < ListView
|
|||||||
|
|
||||||
def instruction_text
|
def instruction_text
|
||||||
return "" unless @interpreter.instruction
|
return "" unless @interpreter.instruction
|
||||||
@interpreter.instruction.to_s.split("(").first
|
@interpreter.instruction.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -29,7 +29,7 @@ class VoolView < ElementView
|
|||||||
method = i.source.method
|
method = i.source.method
|
||||||
end
|
end
|
||||||
#TODO, give mom a source
|
#TODO, give mom a source
|
||||||
when Parfait::TypedMethod
|
when Parfait::Callable
|
||||||
method = i.source
|
method = i.source
|
||||||
when String
|
when String
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user