gisele-vm 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/Gemfile +18 -0
- data/Gemfile.lock +46 -0
- data/LICENCE.md +22 -0
- data/Manifest.txt +15 -0
- data/README.md +10 -0
- data/Rakefile +11 -0
- data/bin/gvm +9 -0
- data/gisele-vm.gemspec +191 -0
- data/gisele-vm.noespec +31 -0
- data/lib/gisele-vm.rb +4 -0
- data/lib/gisele-vm/loader.rb +5 -0
- data/lib/gisele-vm/version.rb +16 -0
- data/lib/gisele/compiling.rb +3 -0
- data/lib/gisele/compiling/gisele2gts.rb +143 -0
- data/lib/gisele/compiling/gts.rb +74 -0
- data/lib/gisele/compiling/gts2bytecode.rb +127 -0
- data/lib/gisele/vm.rb +87 -0
- data/lib/gisele/vm/bytecode.rb +84 -0
- data/lib/gisele/vm/bytecode/builder.rb +77 -0
- data/lib/gisele/vm/bytecode/grammar.citrus +116 -0
- data/lib/gisele/vm/bytecode/grammar.rb +19 -0
- data/lib/gisele/vm/bytecode/grammar.sexp.yml +113 -0
- data/lib/gisele/vm/bytecode/printer.rb +35 -0
- data/lib/gisele/vm/command.rb +140 -0
- data/lib/gisele/vm/component.rb +91 -0
- data/lib/gisele/vm/console.rb +58 -0
- data/lib/gisele/vm/enacter.rb +29 -0
- data/lib/gisele/vm/errors.rb +26 -0
- data/lib/gisele/vm/event.rb +11 -0
- data/lib/gisele/vm/event_manager.rb +65 -0
- data/lib/gisele/vm/kernel.rb +58 -0
- data/lib/gisele/vm/kernel/macros.gvm +214 -0
- data/lib/gisele/vm/kernel/opcodes.rb +212 -0
- data/lib/gisele/vm/kernel/runner.rb +63 -0
- data/lib/gisele/vm/lifecycle.rb +72 -0
- data/lib/gisele/vm/logging.rb +18 -0
- data/lib/gisele/vm/null_object.rb +19 -0
- data/lib/gisele/vm/prog.rb +63 -0
- data/lib/gisele/vm/prog_list.rb +55 -0
- data/lib/gisele/vm/prog_list/memory.rb +74 -0
- data/lib/gisele/vm/prog_list/sqldb.rb +123 -0
- data/lib/gisele/vm/prog_list/storage.rb +31 -0
- data/lib/gisele/vm/proxy.rb +14 -0
- data/lib/gisele/vm/proxy/client.rb +64 -0
- data/lib/gisele/vm/proxy/server.rb +29 -0
- data/lib/gisele/vm/registry.rb +57 -0
- data/lib/gisele/vm/robustness.rb +31 -0
- data/lib/gisele/vm/simulator/resumer.rb +32 -0
- data/spec/command/gvm_compile.cmd +1 -0
- data/spec/command/gvm_compile.stdout +111 -0
- data/spec/command/gvm_gts.cmd +1 -0
- data/spec/command/gvm_gts.stdout +101 -0
- data/spec/command/gvm_help.cmd +1 -0
- data/spec/command/gvm_help.stdout +30 -0
- data/spec/command/gvm_version.cmd +1 -0
- data/spec/command/gvm_version.stdout +2 -0
- data/spec/command/test_command.rb +29 -0
- data/spec/fixtures/complete.gis +13 -0
- data/spec/fixtures/fake_component.rb +24 -0
- data/spec/fixtures/kernel.rb +39 -0
- data/spec/fixtures/ts.adl +11 -0
- data/spec/fixtures/ts.gts +20 -0
- data/spec/fixtures/ts.gvm +19 -0
- data/spec/spec_helper.rb +86 -0
- data/spec/test_examples.rb +29 -0
- data/spec/test_gisele-vm.rb +8 -0
- data/spec/unit/bytecode/builder/test_at.rb +56 -0
- data/spec/unit/bytecode/builder/test_helpers.rb +36 -0
- data/spec/unit/bytecode/builder/test_instruction.rb +35 -0
- data/spec/unit/bytecode/builder/test_to_a.rb +53 -0
- data/spec/unit/bytecode/bytecode.gvm +1 -0
- data/spec/unit/bytecode/grammar/fixtures/comments.gvm +16 -0
- data/spec/unit/bytecode/grammar/fixtures/every.gvm +46 -0
- data/spec/unit/bytecode/grammar/fixtures/singleblock.gvm +2 -0
- data/spec/unit/bytecode/grammar/fixtures/twoblocks.gvm +4 -0
- data/spec/unit/bytecode/grammar/fixtures/with_end.gvm +5 -0
- data/spec/unit/bytecode/grammar/test_array.rb +24 -0
- data/spec/unit/bytecode/grammar/test_block.rb +35 -0
- data/spec/unit/bytecode/grammar/test_boolean.rb +20 -0
- data/spec/unit/bytecode/grammar/test_constant.rb +20 -0
- data/spec/unit/bytecode/grammar/test_eol.rb +20 -0
- data/spec/unit/bytecode/grammar/test_eol_comment.rb +36 -0
- data/spec/unit/bytecode/grammar/test_file.rb +38 -0
- data/spec/unit/bytecode/grammar/test_hash.rb +33 -0
- data/spec/unit/bytecode/grammar/test_instruction.rb +32 -0
- data/spec/unit/bytecode/grammar/test_int.rb +24 -0
- data/spec/unit/bytecode/grammar/test_label.rb +24 -0
- data/spec/unit/bytecode/grammar/test_opcode.rb +23 -0
- data/spec/unit/bytecode/grammar/test_string.rb +25 -0
- data/spec/unit/bytecode/grammar/test_symbol.rb +30 -0
- data/spec/unit/bytecode/test_build.rb +36 -0
- data/spec/unit/bytecode/test_coerce.rb +41 -0
- data/spec/unit/bytecode/test_fetch.rb +20 -0
- data/spec/unit/bytecode/test_grammar.rb +30 -0
- data/spec/unit/bytecode/test_parse.rb +22 -0
- data/spec/unit/bytecode/test_plus.rb +27 -0
- data/spec/unit/bytecode/test_to_a.rb +19 -0
- data/spec/unit/bytecode/test_to_s.rb +32 -0
- data/spec/unit/command/code.gis +3 -0
- data/spec/unit/command/test_vm.rb +51 -0
- data/spec/unit/compiling/gisele2gts/test_on_par_st.rb +51 -0
- data/spec/unit/compiling/gisele2gts/test_on_seq_st.rb +46 -0
- data/spec/unit/compiling/gisele2gts/test_on_task_call_st.rb +37 -0
- data/spec/unit/compiling/gisele2gts/test_on_task_def.rb +49 -0
- data/spec/unit/compiling/gisele2gts/test_on_unit_def.rb +35 -0
- data/spec/unit/compiling/gts2bytecode/test_on_end.rb +31 -0
- data/spec/unit/compiling/gts2bytecode/test_on_event.rb +37 -0
- data/spec/unit/compiling/gts2bytecode/test_on_fork.rb +41 -0
- data/spec/unit/compiling/gts2bytecode/test_on_join.rb +42 -0
- data/spec/unit/compiling/gts2bytecode/test_on_listen.rb +36 -0
- data/spec/unit/compiling/gts2bytecode/test_on_nop.rb +30 -0
- data/spec/unit/component/test_component_name.rb +16 -0
- data/spec/unit/component/test_logging.rb +36 -0
- data/spec/unit/enacter/test_component.rb +11 -0
- data/spec/unit/event/test_to_s.rb +12 -0
- data/spec/unit/event_manager/test_component.rb +9 -0
- data/spec/unit/event_manager/test_subscribe.rb +40 -0
- data/spec/unit/event_manager/test_unsubscribe.rb +39 -0
- data/spec/unit/kernel/macros/test_fork.rb +37 -0
- data/spec/unit/kernel/macros/test_join.rb +43 -0
- data/spec/unit/kernel/macros/test_listen.rb +37 -0
- data/spec/unit/kernel/macros/test_notify.rb +57 -0
- data/spec/unit/kernel/macros/test_react.rb +47 -0
- data/spec/unit/kernel/macros/test_schedule_at.rb +30 -0
- data/spec/unit/kernel/opcodes/test_op_del.rb +42 -0
- data/spec/unit/kernel/opcodes/test_op_event.rb +25 -0
- data/spec/unit/kernel/opcodes/test_op_fetch.rb +27 -0
- data/spec/unit/kernel/opcodes/test_op_flip.rb +17 -0
- data/spec/unit/kernel/opcodes/test_op_fold.rb +29 -0
- data/spec/unit/kernel/opcodes/test_op_fork.rb +63 -0
- data/spec/unit/kernel/opcodes/test_op_forka.rb +51 -0
- data/spec/unit/kernel/opcodes/test_op_get.rb +62 -0
- data/spec/unit/kernel/opcodes/test_op_getr.rb +48 -0
- data/spec/unit/kernel/opcodes/test_op_ifenil.rb +41 -0
- data/spec/unit/kernel/opcodes/test_op_ifezero.rb +32 -0
- data/spec/unit/kernel/opcodes/test_op_invoke.rb +34 -0
- data/spec/unit/kernel/opcodes/test_op_nop.rb +18 -0
- data/spec/unit/kernel/opcodes/test_op_parent.rb +39 -0
- data/spec/unit/kernel/opcodes/test_op_pop.rb +22 -0
- data/spec/unit/kernel/opcodes/test_op_push.rb +17 -0
- data/spec/unit/kernel/opcodes/test_op_save.rb +32 -0
- data/spec/unit/kernel/opcodes/test_op_savea.rb +34 -0
- data/spec/unit/kernel/opcodes/test_op_self.rb +20 -0
- data/spec/unit/kernel/opcodes/test_op_send.rb +20 -0
- data/spec/unit/kernel/opcodes/test_op_set.rb +61 -0
- data/spec/unit/kernel/opcodes/test_op_then.rb +50 -0
- data/spec/unit/kernel/opcodes/test_op_unfold.rb +22 -0
- data/spec/unit/kernel/opcodes/test_op_uuid.rb +16 -0
- data/spec/unit/kernel/runner/test_pop.rb +26 -0
- data/spec/unit/kernel/runner/test_stack.rb +28 -0
- data/spec/unit/kernel/test_progress.rb +47 -0
- data/spec/unit/kernel/test_resume.rb +53 -0
- data/spec/unit/kernel/test_start.rb +36 -0
- data/spec/unit/prog/test_to_hash.rb +29 -0
- data/spec/unit/prog/test_waitlist_eq.rb +20 -0
- data/spec/unit/prog_list/memory/test_component.rb +9 -0
- data/spec/unit/prog_list/memory/test_fetch.rb +40 -0
- data/spec/unit/prog_list/memory/test_pick.rb +39 -0
- data/spec/unit/prog_list/memory/test_save.rb +91 -0
- data/spec/unit/prog_list/memory/test_to_relation.rb +17 -0
- data/spec/unit/prog_list/sqldb/test_component.rb +11 -0
- data/spec/unit/prog_list/sqldb/test_connect.rb +46 -0
- data/spec/unit/prog_list/test_memory.rb +9 -0
- data/spec/unit/prog_list/test_sqldb.rb +13 -0
- data/spec/unit/prog_list/test_storage.rb +51 -0
- data/spec/unit/registry/test_component.rb +9 -0
- data/spec/unit/registry/test_connect.rb +53 -0
- data/spec/unit/registry/test_disconnect.rb +51 -0
- data/spec/unit/registry/test_registration.rb +44 -0
- data/spec/unit/shared/a_component.rb +49 -0
- data/spec/unit/shared/a_storage.rb +114 -0
- data/spec/unit/test_logging.rb +46 -0
- data/spec/unit/test_prog.rb +57 -0
- data/spec/unit/test_prog_list.rb +22 -0
- data/spec/unit/vm/test_event_facace.rb +11 -0
- data/spec/unit/vm/test_initialize.rb +59 -0
- data/spec/unit/vm/test_proglist_facade.rb +21 -0
- data/tasks/debug_mail.rake +75 -0
- data/tasks/debug_mail.txt +13 -0
- data/tasks/gem.rake +73 -0
- data/tasks/spec_test.rake +71 -0
- data/tasks/unit_test.rake +76 -0
- data/tasks/yard.rake +51 -0
- metadata +493 -0
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
group :runtime do
|
4
|
+
gem "gisele-language", "~> 0.6.0"
|
5
|
+
gem "alf", "~> 0.12.2"
|
6
|
+
gem "stamina-core", "~> 0.6.1"
|
7
|
+
gem "sequel", "~> 3.40"
|
8
|
+
gem "eventmachine", "~> 1.0.0"
|
9
|
+
end
|
10
|
+
|
11
|
+
group :extra do
|
12
|
+
gem "sqlite3", "~> 1.3"
|
13
|
+
end
|
14
|
+
|
15
|
+
group :development do
|
16
|
+
gem "rake", "~> 0.9.2"
|
17
|
+
gem "rspec", "~> 2.11"
|
18
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
alf (0.12.2)
|
5
|
+
backports (~> 2.6)
|
6
|
+
myrrha (~> 1.2.1)
|
7
|
+
quickl (~> 0.4.2)
|
8
|
+
backports (2.6.4)
|
9
|
+
citrus (2.4.1)
|
10
|
+
diff-lcs (1.1.3)
|
11
|
+
eventmachine (1.0.0)
|
12
|
+
gisele-language (0.6.0)
|
13
|
+
citrus (~> 2.4)
|
14
|
+
path (~> 1.2)
|
15
|
+
sexpr (~> 0.5.0)
|
16
|
+
myrrha (1.2.2)
|
17
|
+
path (1.3.1)
|
18
|
+
quickl (0.4.3)
|
19
|
+
rake (0.9.2.2)
|
20
|
+
rspec (2.11.0)
|
21
|
+
rspec-core (~> 2.11.0)
|
22
|
+
rspec-expectations (~> 2.11.0)
|
23
|
+
rspec-mocks (~> 2.11.0)
|
24
|
+
rspec-core (2.11.1)
|
25
|
+
rspec-expectations (2.11.1)
|
26
|
+
diff-lcs (~> 1.1.3)
|
27
|
+
rspec-mocks (2.11.1)
|
28
|
+
sequel (3.40.0)
|
29
|
+
sexpr (0.5.1)
|
30
|
+
sqlite3 (1.3.5)
|
31
|
+
stamina-core (0.6.1)
|
32
|
+
quickl (~> 0.4.3)
|
33
|
+
|
34
|
+
PLATFORMS
|
35
|
+
java
|
36
|
+
ruby
|
37
|
+
|
38
|
+
DEPENDENCIES
|
39
|
+
alf (~> 0.12.2)
|
40
|
+
eventmachine (~> 1.0.0)
|
41
|
+
gisele-language (~> 0.6.0)
|
42
|
+
rake (~> 0.9.2)
|
43
|
+
rspec (~> 2.11)
|
44
|
+
sequel (~> 3.40)
|
45
|
+
sqlite3 (~> 1.3)
|
46
|
+
stamina-core (~> 0.6.1)
|
data/LICENCE.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# The MIT Licence
|
2
|
+
|
3
|
+
Copyright (c) 2012 - Bernard Lambeau
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Manifest.txt
ADDED
data/README.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# Gisele::VM
|
2
|
+
|
3
|
+
[![Build Status](https://secure.travis-ci.org/blambeau/gisele-vm.png)](http://travis-ci.org/blambeau/gisele-vm)
|
4
|
+
[![Dependency Status](https://gemnasium.com/blambeau/gisele-vm.png)](https://gemnasium.com/blambeau/gisele-vm)
|
5
|
+
|
6
|
+
A virtual machine for the gisele process language.
|
7
|
+
|
8
|
+
## Links
|
9
|
+
|
10
|
+
https://github.com/blambeau/gisele-vm
|
data/Rakefile
ADDED
data/bin/gvm
ADDED
data/gisele-vm.gemspec
ADDED
@@ -0,0 +1,191 @@
|
|
1
|
+
# We require your library, mainly to have access to the VERSION number.
|
2
|
+
# Feel free to set $version manually.
|
3
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
|
4
|
+
require "gisele-vm/version"
|
5
|
+
$version = Gisele::VM::Version.to_s
|
6
|
+
|
7
|
+
#
|
8
|
+
# This is your Gem specification. Default values are provided so that your library
|
9
|
+
# should be correctly packaged given what you have described in the .noespec file.
|
10
|
+
#
|
11
|
+
Gem::Specification.new do |s|
|
12
|
+
|
13
|
+
################################################################### ABOUT YOUR GEM
|
14
|
+
|
15
|
+
# Gem name (required)
|
16
|
+
s.name = "gisele-vm"
|
17
|
+
|
18
|
+
# Gem version (required)
|
19
|
+
s.version = $version
|
20
|
+
|
21
|
+
# A short summary of this gem
|
22
|
+
#
|
23
|
+
# This is displayed in `gem list -d`.
|
24
|
+
s.summary = "A virtual machine for the gisele process language."
|
25
|
+
|
26
|
+
# A long description of this gem (required)
|
27
|
+
#
|
28
|
+
# The description should be more detailed than the summary. For example,
|
29
|
+
# you might wish to copy the entire README into the description.
|
30
|
+
s.description = "This project provides a virtual machine for the modeling language +gisele+\ndeveloped in the Gisele and PIPAS research projects at UCLouvain"
|
31
|
+
|
32
|
+
# The URL of this gem home page (optional)
|
33
|
+
s.homepage = "https://github.com/blambeau/gisele-vm"
|
34
|
+
|
35
|
+
# Gem publication date (required but auto)
|
36
|
+
#
|
37
|
+
# Today is automatically used by default, uncomment only if
|
38
|
+
# you know what you do!
|
39
|
+
#
|
40
|
+
# s.date = Time.now.strftime('%Y-%m-%d')
|
41
|
+
|
42
|
+
# The license(s) for the library. Each license must be a short name, no
|
43
|
+
# more than 64 characters.
|
44
|
+
#
|
45
|
+
# s.licences = %w{}
|
46
|
+
|
47
|
+
# The rubyforge project this gem lives under (optional)
|
48
|
+
#
|
49
|
+
# s.rubyforge_project = nil
|
50
|
+
|
51
|
+
################################################################### ABOUT THE AUTHORS
|
52
|
+
|
53
|
+
# The list of author names who wrote this gem.
|
54
|
+
#
|
55
|
+
# If you are providing multiple authors and multiple emails they should be
|
56
|
+
# in the same order.
|
57
|
+
#
|
58
|
+
s.authors = ["Bernard Lambeau"]
|
59
|
+
|
60
|
+
# Contact emails for this gem
|
61
|
+
#
|
62
|
+
# If you are providing multiple authors and multiple emails they should be
|
63
|
+
# in the same order.
|
64
|
+
#
|
65
|
+
# NOTE: Somewhat strangly this attribute is always singular!
|
66
|
+
# Don't replace by s.emails = ...
|
67
|
+
s.email = ["blambeau@gmail.com"]
|
68
|
+
|
69
|
+
################################################################### PATHS, FILES, BINARIES
|
70
|
+
|
71
|
+
# Paths in the gem to add to $LOAD_PATH when this gem is
|
72
|
+
# activated (required).
|
73
|
+
#
|
74
|
+
# The default 'lib' is typically sufficient.
|
75
|
+
s.require_paths = ["lib"]
|
76
|
+
|
77
|
+
# Files included in this gem.
|
78
|
+
#
|
79
|
+
# By default, we take all files included in the Manifest.txt file on root
|
80
|
+
# of the project. Entries of the manifest are interpreted as Dir[...]
|
81
|
+
# patterns so that lazy people may use wilcards like lib/**/*
|
82
|
+
#
|
83
|
+
here = File.expand_path(File.dirname(__FILE__))
|
84
|
+
s.files = File.readlines(File.join(here, 'Manifest.txt')).
|
85
|
+
inject([]){|files, pattern| files + Dir[File.join(here, pattern.strip)]}.
|
86
|
+
collect{|x| x[(1+here.size)..-1]}
|
87
|
+
|
88
|
+
# Test files included in this gem.
|
89
|
+
#
|
90
|
+
s.test_files = Dir["test/**/*"] + Dir["spec/**/*"]
|
91
|
+
|
92
|
+
# The path in the gem for executable scripts (optional)
|
93
|
+
#
|
94
|
+
s.bindir = "bin"
|
95
|
+
|
96
|
+
# Executables included in the gem.
|
97
|
+
#
|
98
|
+
s.executables = (Dir["bin/*"]).collect{|f| File.basename(f)}
|
99
|
+
|
100
|
+
################################################################### REQUIREMENTS & INSTALL
|
101
|
+
# Remember the gem version requirements operators and schemes:
|
102
|
+
# = Equals version
|
103
|
+
# != Not equal to version
|
104
|
+
# > Greater than version
|
105
|
+
# < Less than version
|
106
|
+
# >= Greater than or equal to
|
107
|
+
# <= Less than or equal to
|
108
|
+
# ~> Approximately greater than
|
109
|
+
#
|
110
|
+
# Don't forget to have a look at http://lmgtfy.com/?q=Ruby+Versioning+Policies
|
111
|
+
# for setting your gem version.
|
112
|
+
#
|
113
|
+
# For your requirements to other gems, remember that
|
114
|
+
# ">= 2.2.0" (optimistic: specify minimal version)
|
115
|
+
# ">= 2.2.0", "< 3.0" (pessimistic: not greater than the next major)
|
116
|
+
# "~> 2.2" (shortcut for ">= 2.2.0", "< 3.0")
|
117
|
+
# "~> 2.2.0" (shortcut for ">= 2.2.0", "< 2.3.0")
|
118
|
+
#
|
119
|
+
|
120
|
+
#
|
121
|
+
# One call to add_dependency('gem_name', 'gem version requirement') for each
|
122
|
+
# runtime dependency. These gems will be installed with your gem.
|
123
|
+
# One call to add_development_dependency('gem_name', 'gem version requirement')
|
124
|
+
# for each development dependency. These gems are required for developers
|
125
|
+
#
|
126
|
+
s.add_development_dependency("sqlite3", "~> 1.3")
|
127
|
+
s.add_development_dependency("rake", "~> 0.9.2")
|
128
|
+
s.add_development_dependency("rspec", "~> 2.11")
|
129
|
+
s.add_dependency("gisele-language", "~> 0.6.0")
|
130
|
+
s.add_dependency("alf", "~> 0.12.2")
|
131
|
+
s.add_dependency("stamina-core", "~> 0.6.1")
|
132
|
+
s.add_dependency("sequel", "~> 3.40")
|
133
|
+
s.add_dependency("eventmachine", "~> 1.0.0")
|
134
|
+
|
135
|
+
# The version of ruby required by this gem
|
136
|
+
#
|
137
|
+
# Uncomment and set this if your gem requires specific ruby versions.
|
138
|
+
#
|
139
|
+
# s.required_ruby_version = ">= 0"
|
140
|
+
|
141
|
+
# The RubyGems version required by this gem
|
142
|
+
#
|
143
|
+
# s.required_rubygems_version = ">= 0"
|
144
|
+
|
145
|
+
# The platform this gem runs on. See Gem::Platform for details.
|
146
|
+
#
|
147
|
+
# s.platform = nil
|
148
|
+
|
149
|
+
# Extensions to build when installing the gem.
|
150
|
+
#
|
151
|
+
# Valid types of extensions are extconf.rb files, configure scripts
|
152
|
+
# and rakefiles or mkrf_conf files.
|
153
|
+
#
|
154
|
+
s.extensions = []
|
155
|
+
|
156
|
+
# External (to RubyGems) requirements that must be met for this gem to work.
|
157
|
+
# It’s simply information for the user.
|
158
|
+
#
|
159
|
+
s.requirements = nil
|
160
|
+
|
161
|
+
# A message that gets displayed after the gem is installed
|
162
|
+
#
|
163
|
+
# Uncomment and set this if you want to say something to the user
|
164
|
+
# after gem installation
|
165
|
+
#
|
166
|
+
s.post_install_message = nil
|
167
|
+
|
168
|
+
################################################################### SECURITY
|
169
|
+
|
170
|
+
# The key used to sign this gem. See Gem::Security for details.
|
171
|
+
#
|
172
|
+
# s.signing_key = nil
|
173
|
+
|
174
|
+
# The certificate chain used to sign this gem. See Gem::Security for
|
175
|
+
# details.
|
176
|
+
#
|
177
|
+
# s.cert_chain = []
|
178
|
+
|
179
|
+
################################################################### RDOC
|
180
|
+
|
181
|
+
# An ARGV style array of options to RDoc
|
182
|
+
#
|
183
|
+
# See 'rdoc --help' about this
|
184
|
+
#
|
185
|
+
s.rdoc_options = []
|
186
|
+
|
187
|
+
# Extra files to add to RDoc such as README
|
188
|
+
#
|
189
|
+
s.extra_rdoc_files = Dir["README.md"] + Dir["CHANGELOG.md"] + Dir["LICENCE.md"]
|
190
|
+
|
191
|
+
end
|
data/gisele-vm.noespec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
template-info:
|
2
|
+
name: rubygem.noe
|
3
|
+
version: 2.0.0
|
4
|
+
manifest:
|
5
|
+
lib/__lower__/version.rb:
|
6
|
+
ignore: true
|
7
|
+
variables:
|
8
|
+
lower:
|
9
|
+
gisele-vm
|
10
|
+
upper:
|
11
|
+
Gisele::VM
|
12
|
+
version:
|
13
|
+
0.6.0
|
14
|
+
summary: |-
|
15
|
+
A virtual machine for the gisele process language.
|
16
|
+
description: |-
|
17
|
+
This project provides a virtual machine for the modeling language +gisele+
|
18
|
+
developed in the Gisele and PIPAS research projects at UCLouvain
|
19
|
+
authors:
|
20
|
+
- {name: Bernard Lambeau, email: blambeau@gmail.com}
|
21
|
+
links:
|
22
|
+
- https://github.com/blambeau/gisele-vm
|
23
|
+
dependencies:
|
24
|
+
- {name: gisele-language, version: "~> 0.6.0", groups: [runtime]}
|
25
|
+
- {name: alf, version: "~> 0.12.2", groups: [runtime]}
|
26
|
+
- {name: stamina-core, version: "~> 0.6.1", groups: [runtime]}
|
27
|
+
- {name: sequel, version: "~> 3.40", groups: [runtime]}
|
28
|
+
- {name: eventmachine, version: "~> 1.0.0", groups: [runtime]}
|
29
|
+
- {name: sqlite3, version: "~> 1.3", groups: [extra]}
|
30
|
+
- {name: rake, version: "~> 0.9.2", groups: [development]}
|
31
|
+
- {name: rspec, version: "~> 2.11", groups: [development]}
|
data/lib/gisele-vm.rb
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
module Gisele
|
2
|
+
module Compiling
|
3
|
+
class Gisele2Gts < Sexpr::Rewriter
|
4
|
+
grammar Language
|
5
|
+
|
6
|
+
def self.compile(arg, parse_options = {})
|
7
|
+
case arg
|
8
|
+
when String, Path
|
9
|
+
parsed = Gisele.parse(arg, parse_options)
|
10
|
+
sexpr = Gisele.sexpr(parsed)
|
11
|
+
compile(sexpr)
|
12
|
+
else
|
13
|
+
compiler = new
|
14
|
+
compiler.call(arg)
|
15
|
+
compiler.gts
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# if/elsif/else -> guarded commands
|
20
|
+
use Language::IfToCase
|
21
|
+
|
22
|
+
def on_unit_def(sexpr)
|
23
|
+
entry = add_state(:launch, :initial => true)
|
24
|
+
exit = add_state(:end)
|
25
|
+
tasks = sexpr.sexpr_body.select{|n| n.first == :task_def}
|
26
|
+
tasks.each do |task|
|
27
|
+
c_entry, c_exit = apply(task)
|
28
|
+
connect(entry, c_entry, task[1].to_sym)
|
29
|
+
connect(c_exit, exit)
|
30
|
+
end
|
31
|
+
[entry, exit]
|
32
|
+
end
|
33
|
+
|
34
|
+
def on_task_def(sexpr)
|
35
|
+
registry[sexpr[1]] ||= begin
|
36
|
+
entry = add_state(:event)
|
37
|
+
exit = add_state(:end)
|
38
|
+
endevt = add_state(:event)
|
39
|
+
|
40
|
+
sexpr[2...-1].each do |s|
|
41
|
+
apply(s) if s.first == :task_def
|
42
|
+
end
|
43
|
+
|
44
|
+
c_entry, c_exit = apply(sexpr.last)
|
45
|
+
connect(entry, c_entry, start_event(sexpr))
|
46
|
+
connect(c_exit, endevt)
|
47
|
+
connect(endevt, exit, end_event(sexpr))
|
48
|
+
|
49
|
+
[entry, exit]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def on_seq_st(sexpr)
|
54
|
+
entry = add_state(:nop)
|
55
|
+
exit = add_state(:nop)
|
56
|
+
|
57
|
+
current = entry
|
58
|
+
sexpr.sexpr_body.each do |child|
|
59
|
+
c_entry, c_exit = apply(child)
|
60
|
+
connect(current, c_entry)
|
61
|
+
current = c_exit
|
62
|
+
end
|
63
|
+
connect(current, exit)
|
64
|
+
|
65
|
+
[entry, exit]
|
66
|
+
end
|
67
|
+
|
68
|
+
def on_par_st(sexpr)
|
69
|
+
entry = add_state(:fork)
|
70
|
+
exit = add_state(:join)
|
71
|
+
connect(entry, exit, :"(wait)")
|
72
|
+
|
73
|
+
sexpr.sexpr_body.each_with_index do |child,idx|
|
74
|
+
c_entry, c_exit = apply(child)
|
75
|
+
c_end = add_state(:end)
|
76
|
+
connect(entry, c_entry, :"(forked##{idx})")
|
77
|
+
connect(c_exit, c_end, :"(joined)")
|
78
|
+
connect(c_end, exit, :"(notify)")
|
79
|
+
end
|
80
|
+
|
81
|
+
[entry,exit]
|
82
|
+
end
|
83
|
+
|
84
|
+
def on_task_call_st(sexpr)
|
85
|
+
entry = add_state(:fork)
|
86
|
+
exit = add_state(:join)
|
87
|
+
connect(entry, exit, :"(wait)")
|
88
|
+
|
89
|
+
c_entry, c_exit = task_nodes(sexpr)
|
90
|
+
connect(entry, c_entry, :"(forked)")
|
91
|
+
connect(c_exit, exit, :"(notify)")
|
92
|
+
|
93
|
+
[entry, exit]
|
94
|
+
end
|
95
|
+
|
96
|
+
def gts
|
97
|
+
options[:gts] ||= Gts.new
|
98
|
+
end
|
99
|
+
|
100
|
+
private
|
101
|
+
|
102
|
+
def registry
|
103
|
+
@registry ||= {}
|
104
|
+
end
|
105
|
+
|
106
|
+
def task_nodes(sexpr)
|
107
|
+
registry[sexpr.last] || begin
|
108
|
+
entry = add_state(:event)
|
109
|
+
listen = add_state(:listen)
|
110
|
+
endevt = add_state(:event)
|
111
|
+
exit = add_state(:end)
|
112
|
+
connect(entry, listen, start_event(sexpr))
|
113
|
+
connect(listen, endevt, :ended)
|
114
|
+
connect(endevt, exit, end_event(sexpr))
|
115
|
+
[ entry, exit ]
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def start_event(sexpr)
|
120
|
+
{:symbol => :start, :event_args => [ sexpr[1] ]}
|
121
|
+
end
|
122
|
+
|
123
|
+
def end_event(sexpr)
|
124
|
+
{:symbol => :end, :event_args => [ sexpr[1] ]}
|
125
|
+
end
|
126
|
+
|
127
|
+
def add_state(kind = :nop, attrs = {})
|
128
|
+
attrs = attrs.merge(:kind => kind)
|
129
|
+
case kind
|
130
|
+
when :join, :end, :listen
|
131
|
+
attrs[:accepting] = true
|
132
|
+
end
|
133
|
+
gts.add_state(attrs)
|
134
|
+
end
|
135
|
+
|
136
|
+
def connect(source, target, attrs={})
|
137
|
+
attrs = {:symbol => attrs} if Symbol===attrs
|
138
|
+
gts.connect(source, target, {:symbol => nil}.merge(attrs))
|
139
|
+
end
|
140
|
+
|
141
|
+
end # class Gisele2Gts
|
142
|
+
end # module Compiling
|
143
|
+
end # module Gisele
|