a larger while example

need a way to see the code
This commit is contained in:
Torsten Ruger 2018-04-20 19:40:17 +03:00
parent 315be69851
commit 89e221c748
2 changed files with 10 additions and 10 deletions

View File

@ -1,6 +1,6 @@
body body
background-color: black background-color: #1a1a1a
color: white color: white
.one_class, .classes, .vool_view ,.mom_view , .risc_view, .status_view ,.vool_view .one_class, .classes, .vool_view ,.mom_view , .risc_view, .status_view ,.vool_view
@ -81,9 +81,9 @@ body
background-color: #009900 background-color: #009900
.risc_bright , .mom_bright .risc_bright , .mom_bright
padding-right: 6px background-color: black
padding-left: 6px font-size: 1.2rem
background-color: #00E3FF color: #53a5ff
border-radius: 7px border-radius: 7px
.fade_in .fade_in

View File

@ -63,18 +63,18 @@ class SelectView < ElementView
ruby = get_codes[code] ruby = get_codes[code]
Vool::VoolCompiler.ruby_to_vool( as_main(ruby) ) Vool::VoolCompiler.ruby_to_vool( as_main(ruby) )
machine.objects machine.objects
puts "starting"
@interpreter.start machine.risc_init @interpreter.start machine.risc_init
end end
def as_main(statements) def as_main(statements)
"class Space ;def main(arg) ; #{statements}; end; end" "class Space ;def main(arg) ; #{statements}; end; end"
end end
def get_codes def get_codes
{set_internal_byte: "return 'Hello'.set_internal_byte(1,75)" , { while_with_calls: 'a = 0; while( 0 > a); a = 1 + a;end;return a',
called_if: 'if( 10 ); return "then";else;return "else";end' , set_internal_byte: "return 'Hello'.set_internal_byte(1,75)" ,
hello_world: "h = 'Hello World'.putstring;return h", called_if: 'if( 10 ); return "then";else;return "else";end' ,
dynamic_call: "a = 150 ; return a.div10", hello_world: "h = 'Hello World'.putstring;return h",
} dynamic_call: "a = 150 ; return a.div10",
}
end end
end end