revieve volt scaffold

This commit is contained in:
Torsten Ruger 2015-07-29 17:13:04 +03:00
parent 79383d89b1
commit 485f3134dd
19 changed files with 830 additions and 83 deletions

47
Gemfile
View File

@ -1,17 +1,40 @@
source 'https://rubygems.org' source 'https://rubygems.org'
gem 'opal-react', :path => '../react.rb' gem 'volt', :path => "../volt"
gem 'opal-jquery'
gem 'react-source'
gem "parslet" , github: "salama/parslet" # volt uses mongo as the default data store.
gem "salama" , github: "salama/salama" gem 'volt-mongo', '~> 0.1.0'
gem "salama-reader" , github: "salama/salama-reader"
gem "salama-arm" , github: "salama/salama-arm"
gem "salama-object-file" , github: "salama/salama-object-file"
gem "susy"
group :development do # The following gem's are optional for themeing
gem "minitest" # Twitter bootstrap
gem "rubygems-tasks" gem 'volt-bootstrap', '~> 0.0.10'
# Asset compilation gems, they will be required when needed.
gem 'csso-rails', '~> 0.3.4', require: false
gem 'uglifier', '>= 2.4.0', require: false
gem "parslet" , path: "../parslet"
#gem "salama" , path: "../salama"
gem "salama-reader" , path: "../salama-reader"
gem "salama-object-file" , path: "../salama-object-file"
group :test do
# Testing dependencies
gem 'rspec', '~> 3.2.0'
gem 'opal-rspec', '~> 0.4.2'
gem 'capybara', '~> 2.4.2'
gem 'selenium-webdriver', '~> 2.43.0'
gem 'chromedriver2-helper', '~> 0.0.8'
gem 'poltergeist', '~> 1.5.0'
end
# Server for MRI
platform :mri, :mingw do
# The implementation of ReadWriteLock in Volt uses concurrent ruby and ext helps performance.
gem 'concurrent-ruby-ext', '~> 0.8.0'
# Thin is the default volt server, Puma is also supported
gem 'thin', '~> 1.6.0'
gem 'bson_ext', '~> 1.9.0'
end end

View File

@ -1,83 +1,173 @@
GIT PATH
remote: git://github.com/salama/parslet.git remote: ../parslet
revision: beeb9b441a9ade1504f7f0e848d805e36a02c544
specs: specs:
parslet (1.7.0) parslet (1.7.0)
GIT PATH
remote: git://github.com/salama/salama-arm.git remote: ../salama-object-file
revision: 0bd5091e3f284ecf040e0086a41d2449cd5afb7a
specs:
salama-arm (0.0.1)
GIT
remote: git://github.com/salama/salama-object-file.git
revision: fbae6a02764dbe97e01e4833f9ffffe09879b100
specs: specs:
salama-object-file (0.2.0) salama-object-file (0.2.0)
GIT PATH
remote: git://github.com/salama/salama-reader.git remote: ../salama-reader
revision: 841592c667acea1e796f950851262e6938b231bc
specs: specs:
salama-reader (0.2.0) salama-reader (0.2.0)
parslet (~> 1.7.0) parslet (~> 1.7.0)
GIT
remote: git://github.com/salama/salama.git
revision: 3fb08acf3f83aa403b095aa60be1702419d8a66d
specs:
salama (0.2.0)
salama-object-file (~> 0.2)
salama-reader (~> 0.2)
PATH PATH
remote: ../react.rb remote: ../volt
specs: specs:
opal-react (0.2.2) volt (0.9.4)
opal bcrypt (~> 3.1.9)
opal-activesupport bundler (>= 1.5)
concurrent-ruby (= 0.8.0)
configurations (~> 2.0.0.pre)
faye-websocket (~> 0.9.2)
listen (~> 3.0.1)
opal (~> 0.7.2)
pry (~> 0.10.1)
rack (~> 1.5.0)
sass (~> 3.2.5)
sprockets-sass (~> 1.0.0)
thor (~> 0.19.0)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
bcrypt (3.1.10)
bson (1.9.2)
bson_ext (1.9.2)
bson (~> 1.9.2)
capybara (2.4.4)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
childprocess (0.5.6)
ffi (~> 1.0, >= 1.0.11)
chromedriver2-helper (0.0.8)
nokogiri
cliver (0.3.2)
coderay (1.1.0)
concurrent-ruby (0.8.0)
ref (~> 1.0, >= 1.0.5)
concurrent-ruby-ext (0.8.0)
concurrent-ruby (~> 0.8.0)
configurations (2.0.0)
csso-rails (0.3.4)
execjs (>= 1)
daemons (1.2.3)
diff-lcs (1.2.5)
eventmachine (1.0.7)
execjs (2.5.2)
faye-websocket (0.9.2)
eventmachine (>= 0.12.0)
websocket-driver (>= 0.5.1)
ffi (1.9.10)
hike (1.2.3) hike (1.2.3)
minitest (5.7.0) json (1.8.3)
opal (0.8.0) listen (3.0.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
method_source (0.8.2)
mime-types (2.6.1)
mini_portile (0.6.2)
mongo (1.9.2)
bson (~> 1.9.2)
multi_json (1.11.2)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
opal (0.7.2)
hike (~> 1.2) hike (~> 1.2)
sourcemap (~> 0.1.0) sourcemap (~> 0.1.0)
sprockets (~> 3.1) sprockets (>= 2.2.3, < 3.0.0)
tilt (>= 1.4) tilt (~> 1.4)
opal-activesupport (0.1.0) opal-rspec (0.4.3)
opal (>= 0.5.0, < 1.0.0) opal (>= 0.7.0, < 0.9)
opal-jquery (0.4.0) poltergeist (1.5.1)
opal (>= 0.7.0, < 0.9.0) capybara (~> 2.1)
rack (1.6.4) cliver (~> 0.3.1)
react-source (0.13.3) multi_json (~> 1.0)
rubygems-tasks (0.2.4) websocket-driver (>= 0.2.0)
sass (3.4.16) pry (0.10.1)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rack (1.5.5)
rack-test (0.6.3)
rack (>= 1.0)
rb-fsevent (0.9.5)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
ref (1.0.5)
rspec (3.2.0)
rspec-core (~> 3.2.0)
rspec-expectations (~> 3.2.0)
rspec-mocks (~> 3.2.0)
rspec-core (3.2.3)
rspec-support (~> 3.2.0)
rspec-expectations (3.2.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-mocks (3.2.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-support (3.2.2)
rubyzip (1.1.7)
sass (3.2.19)
selenium-webdriver (2.43.0)
childprocess (~> 0.5)
multi_json (~> 1.0)
rubyzip (~> 1.0)
websocket (~> 1.0)
slop (3.6.0)
sourcemap (0.1.1) sourcemap (0.1.1)
sprockets (3.2.0) sprockets (2.12.4)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0) rack (~> 1.0)
susy (2.2.5) tilt (~> 1.1, != 1.3.0)
sass (>= 3.3.0, < 3.5) sprockets-sass (1.0.3)
tilt (2.0.1) sprockets (~> 2.0)
tilt (~> 1.1)
thin (1.6.3)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0)
rack (~> 1.0)
thor (0.19.1)
tilt (1.4.1)
uglifier (2.7.1)
execjs (>= 0.3.0)
json (>= 1.8.0)
volt-bootstrap (0.0.10)
volt-mongo (0.1.1)
mongo (~> 1.9.0)
websocket (1.2.2)
websocket-driver (0.5.4)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
xpath (2.0.0)
nokogiri (~> 1.3)
PLATFORMS PLATFORMS
ruby ruby
DEPENDENCIES DEPENDENCIES
minitest bson_ext (~> 1.9.0)
opal-jquery capybara (~> 2.4.2)
opal-react! chromedriver2-helper (~> 0.0.8)
concurrent-ruby-ext (~> 0.8.0)
csso-rails (~> 0.3.4)
opal-rspec (~> 0.4.2)
parslet! parslet!
react-source poltergeist (~> 1.5.0)
rubygems-tasks rspec (~> 3.2.0)
salama!
salama-arm!
salama-object-file! salama-object-file!
salama-reader! salama-reader!
susy selenium-webdriver (~> 2.43.0)
thin (~> 1.6.0)
BUNDLED WITH uglifier (>= 2.4.0)
1.10.5 volt!
volt-bootstrap (~> 0.0.10)
volt-mongo (~> 0.1.0)

View File

@ -1,22 +1,9 @@
### statement of intent
just starting and not quite sure, but here is the direction
# Debugger # Debugger
After some tryouts it ended up being an Opal application. That is ruby as javascript in the browser.
![Debugger](https://raw.githubusercontent.com/salama/salama-debugger/master/static/debugger.png)
- On the left are the classes of the system. Next idea is to have hover info about them.
- Next a source code view (not implemented)
- next a view of the Virtual Instructions
- last section, current block with current Register Instruction highlighted
- step (next) button for single stepping
- status: starting , running , exited
- bottom row are the registers. If the register hold an object the variables are shown.
(also should have hover info) , the first letter indicates the class, the number is the address
So lots to do, but a good start.
I don't want to use gdb anymore, and it would be easier without using the qemu setup, so: I don't want to use gdb anymore, and it would be easier without using the qemu setup, so:
- single step debugging of the register machine level (as close to arm as need be) - single step debugging of the register machine level (as close to arm as need be)

1
assets/css/app.css.scss Normal file
View File

@ -0,0 +1 @@
// Place your apps css here

307
assets/css/hint.css Normal file
View File

@ -0,0 +1,307 @@
/*! Hint.css - v1.3.5 - 2015-06-16
* http://kushagragour.in/lab/hint/
* Copyright (c) 2015 Kushagra Gour; Licensed MIT */
/*-------------------------------------*\
HINT.css - A CSS tooltip library
\*-------------------------------------*/
/**
* HINT.css is a tooltip library made in pure CSS.
*
* Source: https://github.com/chinchang/hint.css
* Demo: http://kushagragour.in/lab/hint/
*
* Release under The MIT License
*
*/
/**
* source: hint-core.scss
*
* Defines the basic styling for the tooltip.
* Each tooltip is made of 2 parts:
* 1) body (:after)
* 2) arrow (:before)
*
* Classes added:
* 1) hint
*/
.hint, [data-hint] {
position: relative;
display: inline-block;
/**
* tooltip arrow
*/
/**
* tooltip body
*/ }
.hint:before, .hint:after, [data-hint]:before, [data-hint]:after {
position: absolute;
-webkit-transform: translate3d(0, 0, 0);
-moz-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
visibility: hidden;
opacity: 0;
z-index: 1000000;
pointer-events: none;
-webkit-transition: 0.3s ease;
-moz-transition: 0.3s ease;
transition: 0.3s ease;
-webkit-transition-delay: 0ms;
-moz-transition-delay: 0ms;
transition-delay: 0ms; }
.hint:hover:before, .hint:hover:after, .hint:focus:before, .hint:focus:after, [data-hint]:hover:before, [data-hint]:hover:after, [data-hint]:focus:before, [data-hint]:focus:after {
visibility: visible;
opacity: 1; }
.hint:hover:before, .hint:hover:after, [data-hint]:hover:before, [data-hint]:hover:after {
-webkit-transition-delay: 100ms;
-moz-transition-delay: 100ms;
transition-delay: 100ms; }
.hint:before, [data-hint]:before {
content: '';
position: absolute;
background: transparent;
border: 6px solid transparent;
z-index: 1000001; }
.hint:after, [data-hint]:after {
content: attr(data-hint);
background: #383838;
color: white;
padding: 8px 10px;
font-size: 12px;
line-height: 12px;
white-space: nowrap; }
/**
* source: hint-position.scss
*
* Defines the positoning logic for the tooltips.
*
* Classes added:
* 1) hint--top
* 2) hint--bottom
* 3) hint--left
* 4) hint--right
*/
/**
* set default color for tooltip arrows
*/
.hint--top:before {
border-top-color: #383838; }
.hint--bottom:before {
border-bottom-color: #383838; }
.hint--left:before {
border-left-color: #383838; }
.hint--right:before {
border-right-color: #383838; }
/**
* top tooltip
*/
.hint--top:before {
margin-bottom: -12px; }
.hint--top:after {
margin-left: -18px; }
.hint--top:before, .hint--top:after {
bottom: 100%;
left: 50%; }
.hint--top:hover:after, .hint--top:hover:before, .hint--top:focus:after, .hint--top:focus:before {
-webkit-transform: translateY(-8px);
-moz-transform: translateY(-8px);
transform: translateY(-8px); }
/**
* bottom tooltip
*/
.hint--bottom:before {
margin-top: -12px; }
.hint--bottom:after {
margin-left: -18px; }
.hint--bottom:before, .hint--bottom:after {
top: 100%;
left: 50%; }
.hint--bottom:hover:after, .hint--bottom:hover:before, .hint--bottom:focus:after, .hint--bottom:focus:before {
-webkit-transform: translateY(8px);
-moz-transform: translateY(8px);
transform: translateY(8px); }
/**
* right tooltip
*/
.hint--right:before {
margin-left: -12px;
margin-bottom: -6px; }
.hint--right:after {
margin-bottom: -14px; }
.hint--right:before, .hint--right:after {
left: 100%;
bottom: 50%; }
.hint--right:hover:after, .hint--right:hover:before, .hint--right:focus:after, .hint--right:focus:before {
-webkit-transform: translateX(8px);
-moz-transform: translateX(8px);
transform: translateX(8px); }
/**
* left tooltip
*/
.hint--left:before {
margin-right: -12px;
margin-bottom: -6px; }
.hint--left:after {
margin-bottom: -14px; }
.hint--left:before, .hint--left:after {
right: 100%;
bottom: 50%; }
.hint--left:hover:after, .hint--left:hover:before, .hint--left:focus:after, .hint--left:focus:before {
-webkit-transform: translateX(-8px);
-moz-transform: translateX(-8px);
transform: translateX(-8px); }
/**
* source: hint-theme.scss
*
* Defines basic theme for tooltips.
*
*/
.hint, [data-hint] {
/**
* tooltip body
*/ }
.hint:after, [data-hint]:after {
text-shadow: 0 -1px 0px black;
box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.3); }
/**
* source: hint-color-types.scss
*
* Contains tooltips of various types based on color differences.
*
* Classes added:
* 1) hint--error
* 2) hint--warning
* 3) hint--info
* 4) hint--success
*
*/
/**
* Error
*/
.hint--error:after {
background-color: #b34e4d;
text-shadow: 0 -1px 0px #592726; }
.hint--error.hint--top:before {
border-top-color: #b34e4d; }
.hint--error.hint--bottom:before {
border-bottom-color: #b34e4d; }
.hint--error.hint--left:before {
border-left-color: #b34e4d; }
.hint--error.hint--right:before {
border-right-color: #b34e4d; }
/**
* Warning
*/
.hint--warning:after {
background-color: #c09854;
text-shadow: 0 -1px 0px #6c5328; }
.hint--warning.hint--top:before {
border-top-color: #c09854; }
.hint--warning.hint--bottom:before {
border-bottom-color: #c09854; }
.hint--warning.hint--left:before {
border-left-color: #c09854; }
.hint--warning.hint--right:before {
border-right-color: #c09854; }
/**
* Info
*/
.hint--info:after {
background-color: #3986ac;
text-shadow: 0 -1px 0px #193b4d; }
.hint--info.hint--top:before {
border-top-color: #3986ac; }
.hint--info.hint--bottom:before {
border-bottom-color: #3986ac; }
.hint--info.hint--left:before {
border-left-color: #3986ac; }
.hint--info.hint--right:before {
border-right-color: #3986ac; }
/**
* Success
*/
.hint--success:after {
background-color: #458746;
text-shadow: 0 -1px 0px #1a321a; }
.hint--success.hint--top:before {
border-top-color: #458746; }
.hint--success.hint--bottom:before {
border-bottom-color: #458746; }
.hint--success.hint--left:before {
border-left-color: #458746; }
.hint--success.hint--right:before {
border-right-color: #458746; }
/**
* source: hint-always.scss
*
* Defines a persisted tooltip which shows always.
*
* Classes added:
* 1) hint--always
*
*/
.hint--always:after, .hint--always:before {
opacity: 1;
visibility: visible; }
.hint--always.hint--top:after, .hint--always.hint--top:before {
-webkit-transform: translateY(-8px);
-moz-transform: translateY(-8px);
transform: translateY(-8px); }
.hint--always.hint--bottom:after, .hint--always.hint--bottom:before {
-webkit-transform: translateY(8px);
-moz-transform: translateY(8px);
transform: translateY(8px); }
.hint--always.hint--left:after, .hint--always.hint--left:before {
-webkit-transform: translateX(-8px);
-moz-transform: translateX(-8px);
transform: translateX(-8px); }
.hint--always.hint--right:after, .hint--always.hint--right:before {
-webkit-transform: translateX(8px);
-moz-transform: translateX(8px);
transform: translateX(8px); }
/**
* source: hint-rounded.scss
*
* Defines rounded corner tooltips.
*
* Classes added:
* 1) hint--rounded
*
*/
.hint--rounded:after {
border-radius: 4px; }
/**
* source: hint-effects.scss
*
* Defines various transition effects for the tooltips.
*
* Classes added:
* 1) hint--no-animate
* 2) hint--bounce
*
*/
.hint--no-animate:before, .hint--no-animate:after {
-webkit-transition-duration: 0ms;
-moz-transition-duration: 0ms;
transition-duration: 0ms; }
.hint--bounce:before, .hint--bounce:after {
-webkit-transition: opacity 0.3s ease, visibility 0.3s ease, -webkit-transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);
-moz-transition: opacity 0.3s ease, visibility 0.3s ease, -moz-transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);
transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24); }

BIN
assets/images/bunny.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

11
config/dependencies.rb Normal file
View File

@ -0,0 +1,11 @@
# Specify which components you wish to include when
# the "home" component loads.
# bootstrap css framework
component 'bootstrap'
Opal.use_gem("salama-reader")
Opal.use_gem("salama-object-file")
Opal.append_path "app/main/lib"
css_file "hint.css"

View File

@ -0,0 +1,10 @@
# Place any code you want to run when the component is included on the client
# or server.
# To include code only on the client use:
# if RUBY_PLATFORM == 'opal'
#
# To include code only on the server, use:
# unless RUBY_PLATFORM == 'opal'
# ^^ this will not send compile in code in the conditional to the client.
# ^^ this include code required in the conditional.

View File

7
config/routes.rb Normal file
View File

@ -0,0 +1,7 @@
# See https://github.com/voltrb/volt#routes for more info on routes
client '/about', action: 'about'
# The main route, this should be last. It will match any params not
# previously matched.
client '/', {}

View File

@ -0,0 +1,69 @@
require "opal/parser" # to get eval to work
$LOAD_PATH.unshift("/Users/raisa/salama/salama-debugger/app/main/lib")
require "salama"
Virtual::Machine.boot
module Main
class MainController < Volt::ModelController
def index
page._registers!.clear
page._classes!.clear
page._objects!.clear
page._source = InstructionModel.new nil
page._block = BlockModel.new nil
fill_regs
parse_and_fill
end
def about
end
private
def parse_and_fill
ParseTask.parse(1).then do |result|
is = Ast::Expression.from_basic(result)
Virtual::Compiler.compile( is , Virtual.machine.space.get_main )
Virtual.machine.run_before "Register::CallImplementation"
fill_classes
end.fail do |error|
raise "Error: #{error}"
end
end
def fill_classes
Virtual.machine.space.classes.each do |name , claz|
next if [:Kernel,:Module,:MetaClass,:BinaryCode].index name
c = Volt::Model.new :name => name
page._classes << c
end
b = Virtual.machine.init
page._block = BlockModel.new b
page._source = InstructionModel.new b.codes.first.source
end
def fill_regs
register_names = (0..8).collect {|i| "r#{i}"}
register_names.each do |reg_name|
reg = Volt::Model.new :name => reg_name
page._registers << reg
end
end
# The main template contains a #template binding that shows another
# template. This is the path to that template. It may change based
# on the params._component, params._controller, and params._action values.
def main_path
"#{params._component || 'main'}/#{params._controller || 'main'}/#{params._action || 'index'}"
end
# Determine if the current nav component is the active one by looking
# at the first part of the url against the href attribute.
def active_tab?
url.path.split('/')[1] == attrs.href.split('/')[1]
end
end
end

29
lib/object_view.rb Normal file
View File

@ -0,0 +1,29 @@
class ObjectView
attr_accessor :text , :object , :attributes
def initialize o
super()
puts "NO O " unless o
self.object = o
self.text = short
@attributes = {}
end
def short
object.class.name.split("::").last[0 .. 3]
end
def is_parfait
object.class.name.split("::").first == "Parfait"
end
def set name , val
@attributes[name] = val
self.text.text = short + @attributes.length.to_s
end
def get(name)
@attributes[name]
end
end

99
lib/space_view.rb Normal file
View File

@ -0,0 +1,99 @@
class SpaceView
include Sof::Util
def initialize max
super()
space = Virtual.machine.space
# just a way to get the space into a list. objects is an id => occurence mapping.
# occurence.object is the object
objects = Sof::Members.new(space).objects
@objects = objects
puts "Objects #{objects.length}"
# create a mapping from id to volt models
@view_objects = {}
@objects.each do |i , o|
ob = o.object
next unless ob
next if basic?(ob)
next if ob.class.name.include? "Binary"
next if ob.class.name.include? "Array"
puts "object #{ob.class.name}"
view = ObjectView.new ob
@view_objects[i] = view
add_child view.text
end
fill_attributes
end
def fill_attributes
@view_objects.each do |i , view|
ob = view.object
next if is_value?(ob)
case ob.class.name
when "Array" , "Parfait::List"
fill_array view
when "Hash" , "Parfait::Dictionary"
fill_hash view
else
# next if basic?(ob)
attributes = attributes_for(ob)
attributes.each do |a|
next if a == "html_safe"
next if a == "constructor"
next if a == "toString"
next if a == "position"
val = get_value( ob , a)
if( @view_objects[val.object_id])
val = @view_objects[val.object_id]
end
#puts "set #{a}"
view.set(a , val )
end
superclasses = [ob.class.superclass.name]
if superclasses.include?( "Array") or superclasses.include?( "Parfait::List")
fill_array view
end
if superclasses.include?( "Hash") or superclasses.include?( "Parfait::Dictionary")
fill_hash view
end
end
end
end
def basic? ob
return true if ob.class.name.include?("::") and !ob.class.name.include?("Parfait")
return true if ob.class.name == "Proc"
return true if ob.class.name == "String"
return true if ob.class.name == "Numeric"
return true if ob.class.name == "Class"
false
end
# and hash keys/values
def fill_hash view_hash
view_hash.object.each do |k , val|
if( @view_objects[val.object_id])
val = @view_objects[val.object_id]
end
view_hash.set(k , val )
end
end
# and array values
def fill_array view_array
index = 0
view_array.object.each do |val|
if( @view_objects[val.object_id])
val = @view_objects[val.object_id]
end
view_array.set("#{index}" , val )
index += 1
end
#puts "set #{a}"
end
end

13
models/block_model.rb Normal file
View File

@ -0,0 +1,13 @@
# represent a block and hold the actual instance (as transient)
class BlockModel < Volt::Model
field :name
attr_accessor :block
def initialize(b)
super()
@block = b
self.name = b.nil? ? 'undefined' : b.name
end
end

View File

@ -0,0 +1,13 @@
# represent an instruction and hold the actual instance (as transient)
class InstructionModel < Volt::Model
field :name
attr_accessor :instruction
def initialize(i)
super()
@instruction = i
self.name = i.class.name
end
end

11
tasks/parse_task.rb Normal file
View File

@ -0,0 +1,11 @@
require "salama-reader"
class ParseTask < Volt::Task
def parse(num)
string_input = '"Hello again".putstring()'
parser = Parser::Salama.new
out = parser.parse(string_input)
parts = Parser::Transform.new.apply(out)
parts.to_basic
end
end

7
views/main/about.html Normal file
View File

@ -0,0 +1,7 @@
<:Title>
About
<:Body>
<h1>About</h1>
<p>About page...</p>

43
views/main/index.html Normal file
View File

@ -0,0 +1,43 @@
<:Title>
Debugger
<:Body>
<div class="row">
{{ page._classes.each do |c| }}
<div class="col-md-1">
{{ c._name }} <br/>
</div>
{{ end }}
</div>
<div class="row">
<div class="col-md-3">
Messages
</div>
<div class="col-md-3">
Source Code
</div>
<div class="col-md-3">
<div class="row">
Virtual Machine Instruction : {{ page._source._name}}
</div>
</div>
<div class="col-md-3">
<div class="row">
Current block: {{ page._block._name}}
</div>
<div class="row">
{{ if page._block.block }}
{{ page._block.block.codes.each do |c| }}
{{ c.to_s }}
{{ end }}
{{ end }}
</div>
</div>
</div>
<div class="row">
{{ page._registers.each do |r| }}
<div class="col-md-1">
{{ r._name }} : {{ r._content }}
</div>
{{ end }}
</div>

27
views/main/main.html Normal file
View File

@ -0,0 +1,27 @@
<:Title>
{{ view main_path, "title", {controller_group: 'main'} }}
<:Body>
<div class="container">
<div class="header">
<ul class="nav nav-pills pull-right">
<:nav href="/">Home</:nav>
<:nav href="/about">About</:nav>
</ul>
<h3 class="text-muted">Salama Debugger</h3>
</div>
<:volt:notices />
{{ view main_path, 'body', {controller_group: 'main'} }}
<div class="footer">
<p> <a href="http://salama-vm.org/" >Salama</a> {{ Time.now.year }}</p>
</div>
</div>
<:Nav>
<li class="{{ if active_tab? }}active{{ end }}">
<a href="{{ attrs.href }}">{{ yield }}</a>
</li>