diff --git a/app/main/controllers/main_controller.rb b/app/main/controllers/main_controller.rb index b505b0d..ec88232 100644 --- a/app/main/controllers/main_controller.rb +++ b/app/main/controllers/main_controller.rb @@ -1,4 +1,5 @@ # By default Volt generates this controller for your Main component +require "salama" if RUBY_PLATFORM == 'opal' require "main/lib/main_view" @@ -12,7 +13,11 @@ module Main end def about - # Add code for when the about view is loaded + promise = ParseTask.parse(1).then do |result| + puts result + end.fail do |error| + puts "Error: #{error}" + end end private diff --git a/app/main/tasks/parse_task.rb b/app/main/tasks/parse_task.rb new file mode 100644 index 0000000..fa4eccb --- /dev/null +++ b/app/main/tasks/parse_task.rb @@ -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) + Sof.write parts + end +end diff --git a/config/initializers/boot_salama.rb b/config/initializers/boot_salama.rb new file mode 100644 index 0000000..b83f91a --- /dev/null +++ b/config/initializers/boot_salama.rb @@ -0,0 +1,3 @@ +#require "salama" + +Virtual::Machine.boot