gisele 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +73 -44
- data/Gemfile.lock +1 -0
- data/examples/meeting-scheduler/MeetingScheduling.gis +23 -23
- data/examples/rectal-cancer-pathway/RectalCancerPathway.gis +64 -0
- data/gisele.noespec +1 -1
- data/lib/gisele/command.rb +6 -4
- data/lib/gisele/language/ast/case_st.rb +14 -0
- data/lib/gisele/language/ast/else_clause.rb +14 -0
- data/lib/gisele/language/ast/node.rb +3 -1
- data/lib/gisele/language/ast/{unit.rb → unit_def.rb} +2 -2
- data/lib/gisele/language/dot.yml +1 -1
- data/lib/gisele/language/elsif_flattener.rb +35 -0
- data/lib/gisele/language/if_to_case.rb +63 -0
- data/lib/gisele/language/rewriter/helper.rb +41 -0
- data/lib/gisele/language/rewriter/scoping.rb +34 -0
- data/lib/gisele/language/rewriter/work_on_nodes.rb +30 -0
- data/lib/gisele/language/rewriter.rb +60 -0
- data/lib/gisele/language/sugar_removal.rb +2 -64
- data/lib/gisele/language/syntax/case_st.rb +19 -0
- data/lib/gisele/language/syntax/grammar.citrus +61 -28
- data/lib/gisele/language/syntax/node.rb +3 -3
- data/lib/gisele/language/syntax/task_def.rb +5 -4
- data/lib/gisele/language/syntax/{unit.rb → unit_def.rb} +3 -3
- data/lib/gisele/language/syntax/when_clause.rb +16 -0
- data/lib/gisele/language/to_graph.rb +43 -16
- data/lib/gisele/language.rb +25 -1
- data/lib/gisele/version.rb +1 -1
- data/spec/command/main/gisele_ast_ruby.stdout +29 -35
- data/spec/command/main/gisele_graph.stdout +24 -14
- data/spec/command/main/gisele_help.stdout +1 -1
- data/spec/command/main/gisele_no_sugar.cmd +1 -1
- data/spec/command/main/gisele_no_sugar.stdout +119 -25
- data/spec/command/main/gisele_version.stdout +1 -1
- data/spec/fixtures/tasks/complete.gis +24 -2
- data/spec/fixtures/tasks/simple.ast +29 -35
- data/spec/fixtures/tasks/simple.gis +7 -2
- data/spec/spec_helper.rb +10 -0
- data/spec/unit/language/ast/test_node.rb +10 -11
- data/spec/unit/language/rewriter/test_helper.rb +87 -0
- data/spec/unit/language/rewriter/test_scoping.rb +46 -0
- data/spec/unit/language/rewriter/test_work_on_nodes.rb +45 -0
- data/spec/unit/language/syntax/grammar/test_bool_expr.rb +34 -0
- data/spec/unit/language/syntax/grammar/test_boolean_literal.rb +17 -0
- data/spec/unit/language/syntax/grammar/test_case_st.rb +60 -0
- data/spec/unit/language/syntax/grammar/test_event.rb +18 -0
- data/spec/unit/language/syntax/grammar/test_event_name.rb +21 -0
- data/spec/unit/language/syntax/grammar/test_event_set.rb +27 -0
- data/spec/unit/language/syntax/grammar/test_fluent_def.rb +21 -0
- data/spec/unit/language/syntax/grammar/test_if_st.rb +21 -0
- data/spec/unit/language/syntax/grammar/test_par_st.rb +11 -0
- data/spec/unit/language/syntax/grammar/test_process_statement.rb +19 -0
- data/spec/unit/language/syntax/grammar/test_seq_st.rb +11 -0
- data/spec/unit/language/syntax/grammar/test_spaces.rb +19 -0
- data/spec/unit/language/syntax/grammar/test_spacing.rb +18 -0
- data/spec/unit/language/syntax/grammar/test_task_def.rb +35 -0
- data/spec/unit/language/syntax/grammar/test_task_name.rb +19 -0
- data/spec/unit/language/syntax/grammar/test_task_start_or_end.rb +17 -0
- data/spec/unit/language/syntax/grammar/test_trackvar_def.rb +21 -0
- data/spec/unit/language/syntax/grammar/test_unit_def.rb +29 -0
- data/spec/unit/language/syntax/grammar/test_variable_name.rb +30 -0
- data/spec/unit/language/syntax/grammar/test_when_clause.rb +21 -0
- data/spec/unit/language/syntax/grammar/test_while_st.rb +11 -0
- data/spec/unit/language/syntax/to_ast/test_bool_expr.rb +28 -0
- data/spec/unit/language/syntax/to_ast/test_case_st.rb +47 -0
- data/spec/unit/language/syntax/to_ast/test_else_clause.rb +13 -0
- data/spec/unit/language/syntax/to_ast/test_elsif_clause.rb +15 -0
- data/spec/unit/language/syntax/to_ast/test_event_set.rb +24 -0
- data/spec/unit/language/syntax/to_ast/test_fluent_def.rb +26 -0
- data/spec/unit/language/syntax/to_ast/test_if_st.rb +39 -0
- data/spec/unit/language/syntax/to_ast/test_par_st.rb +12 -0
- data/spec/unit/language/syntax/to_ast/test_seq_st.rb +12 -0
- data/spec/unit/language/syntax/to_ast/test_task_call_st.rb +10 -0
- data/spec/unit/language/syntax/to_ast/test_task_def.rb +44 -0
- data/spec/unit/language/syntax/to_ast/test_trackvar_def.rb +26 -0
- data/spec/unit/language/syntax/to_ast/test_unit_def.rb +28 -0
- data/spec/unit/language/syntax/to_ast/test_var_ref.rb +12 -0
- data/spec/unit/language/syntax/to_ast/test_when_clause.rb +15 -0
- data/spec/unit/language/syntax/to_ast/test_while_st.rb +24 -0
- data/spec/unit/language/test_ast.rb +4 -4
- data/spec/unit/language/test_elsif_flattener.rb +90 -0
- data/spec/unit/language/test_if_to_case.rb +107 -0
- data/spec/unit/language/{test_transformer.rb → test_rewriter.rb} +24 -11
- data/spec/unit/language/test_syntax.rb +1 -1
- data/spec/unit/language/test_to_graph.rb +9 -2
- metadata +120 -34
- data/lib/gisele/language/syntax/task_refinement.rb +0 -15
- data/lib/gisele/language/syntax/task_signature.rb +0 -15
- data/lib/gisele/language/transformer.rb +0 -38
- data/spec/unit/language/sugar_removal/test_if_to_guarded_commands.rb +0 -110
- data/spec/unit/language/syntax/test_grammar.rb +0 -317
- data/spec/unit/language/syntax/test_to_ast.rb +0 -257
@@ -1,74 +1,12 @@
|
|
1
1
|
module Gisele
|
2
2
|
module Language
|
3
|
-
class SugarRemoval <
|
3
|
+
class SugarRemoval < Rewriter
|
4
4
|
alias :on_missing :copy_and_applyall
|
5
5
|
|
6
6
|
def on_if_st(node)
|
7
|
-
|
7
|
+
ElsifFlattener.new(:mainflow => self).call(node)
|
8
8
|
end
|
9
9
|
|
10
|
-
class IfToGuardedCommands < Transformer
|
11
|
-
|
12
|
-
def initialize(main)
|
13
|
-
@main = main
|
14
|
-
end
|
15
|
-
|
16
|
-
def on_if_st(node)
|
17
|
-
condition, dost, *clauses = node.children
|
18
|
-
|
19
|
-
# create case_st with same markers as the if_st
|
20
|
-
when_clause = [:when_clause, condition, @main.call(dost)]
|
21
|
-
when_clause = node(when_clause, node.markers.dup)
|
22
|
-
base = [:case_st, when_clause]
|
23
|
-
base = node(base, node.markers.dup)
|
24
|
-
|
25
|
-
# this is the condition for elsif clauses
|
26
|
-
@condition = negate(condition.last)
|
27
|
-
|
28
|
-
# make injection now
|
29
|
-
clauses.inject base do |memo,clause|
|
30
|
-
memo << call(clause)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def on_elsif_clause(node)
|
35
|
-
condition, dost, = node.children
|
36
|
-
|
37
|
-
# install new conditions for me and next elsif clauses
|
38
|
-
condition = condition.last
|
39
|
-
previous = @condition
|
40
|
-
@condition = [:bool_and, negate(condition), @condition]
|
41
|
-
|
42
|
-
# convert elsif to when and keep the markers
|
43
|
-
base = \
|
44
|
-
[:when_clause,
|
45
|
-
[:bool_expr, [:bool_and, condition, previous]],
|
46
|
-
@main.call(dost) ]
|
47
|
-
node(base, node.markers.dup)
|
48
|
-
end
|
49
|
-
|
50
|
-
def on_else_clause(node)
|
51
|
-
dost, = node.children
|
52
|
-
|
53
|
-
# convert else to when and keep the markers
|
54
|
-
base = \
|
55
|
-
[:when_clause,
|
56
|
-
[:bool_expr, @condition],
|
57
|
-
@main.call(dost)]
|
58
|
-
node(base, node.markers.dup)
|
59
|
-
end
|
60
|
-
|
61
|
-
private
|
62
|
-
|
63
|
-
def negate(cond)
|
64
|
-
if cond.rule_name == :bool_not
|
65
|
-
cond.last
|
66
|
-
else
|
67
|
-
[:bool_not, cond]
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
end # class IfToGuardedCommands
|
72
10
|
end # class SugarRemoval
|
73
11
|
end # module Language
|
74
12
|
end # module Gisele
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Gisele
|
2
|
+
module Language
|
3
|
+
module Syntax
|
4
|
+
module CaseSt
|
5
|
+
include Node
|
6
|
+
|
7
|
+
def _to_ast
|
8
|
+
var = captures[:var_ref].first
|
9
|
+
var = var.to_ast if var
|
10
|
+
var = nil if var && var.empty?
|
11
|
+
whens = captures[:when_clause].map{|x| x.to_ast}
|
12
|
+
els = captures[:else_clause].map{|x| x.to_ast}
|
13
|
+
[:case_st, var] + whens + els
|
14
|
+
end
|
15
|
+
|
16
|
+
end # module CaseSt
|
17
|
+
end # module Syntax
|
18
|
+
end # module Language
|
19
|
+
end # module Gisele
|
@@ -2,30 +2,23 @@ grammar Gisele::Language::Syntax::Grammar
|
|
2
2
|
|
3
3
|
### Units
|
4
4
|
|
5
|
-
rule
|
6
|
-
(
|
7
|
-
<Gisele::Language::Syntax::
|
5
|
+
rule unit_def
|
6
|
+
(spacing task_def (spaces task_def)* spacing)
|
7
|
+
<Gisele::Language::Syntax::UnitDef>
|
8
8
|
end
|
9
9
|
|
10
10
|
### Task definitions
|
11
11
|
|
12
12
|
rule task_def
|
13
|
-
('task' spaces task_name spaces
|
13
|
+
('task' spaces task_name spaces
|
14
|
+
(some_def spaces)*
|
15
|
+
(explicit_statement spaces)?
|
16
|
+
'end')
|
14
17
|
<Gisele::Language::Syntax::TaskDef>
|
15
18
|
end
|
16
19
|
|
17
|
-
rule
|
18
|
-
|
19
|
-
<Gisele::Language::Syntax::TaskSignature>
|
20
|
-
end
|
21
|
-
|
22
|
-
rule task_signature_element
|
23
|
-
fluent_def | trackvar_def
|
24
|
-
end
|
25
|
-
|
26
|
-
rule task_refinement
|
27
|
-
('refinement' spaces process_statement spaces 'end')
|
28
|
-
<Gisele::Language::Syntax::TaskRefinement>
|
20
|
+
rule some_def
|
21
|
+
fluent_def | trackvar_def | task_def
|
29
22
|
end
|
30
23
|
|
31
24
|
### Process statements
|
@@ -46,24 +39,42 @@ grammar Gisele::Language::Syntax::Grammar
|
|
46
39
|
|
47
40
|
rule explicit_statement
|
48
41
|
if_st
|
42
|
+
| case_st
|
49
43
|
| while_st
|
50
44
|
| seq_st
|
51
45
|
| par_st
|
52
46
|
| task_call_st
|
53
47
|
end
|
54
48
|
|
49
|
+
rule case_st
|
50
|
+
('case' spaces (var_ref spaces)?
|
51
|
+
(when_clause spaces)+
|
52
|
+
(else_clause spaces)?
|
53
|
+
'end')
|
54
|
+
<Gisele::Language::Syntax::CaseSt>
|
55
|
+
end
|
56
|
+
|
57
|
+
rule when_clause
|
58
|
+
('when' spaces bool_expr spaces process_statement)
|
59
|
+
<Gisele::Language::Syntax::WhenClause>
|
60
|
+
end
|
61
|
+
|
55
62
|
rule if_st
|
56
|
-
('if' spaces bool_expr spaces
|
63
|
+
('if' spaces bool_expr spaces
|
64
|
+
process_statement spaces
|
65
|
+
(elsif_clause spaces)*
|
66
|
+
(else_clause spaces)?
|
67
|
+
'end')
|
57
68
|
<Gisele::Language::Syntax::IfSt>
|
58
69
|
end
|
59
70
|
|
60
71
|
rule elsif_clause
|
61
|
-
('elsif' spaces bool_expr spaces process_statement
|
72
|
+
('elsif' spaces bool_expr spaces process_statement)
|
62
73
|
<Gisele::Language::Syntax::ElsifClause>
|
63
74
|
end
|
64
75
|
|
65
76
|
rule else_clause
|
66
|
-
('else' spaces process_statement
|
77
|
+
('else' spaces process_statement)
|
67
78
|
<Gisele::Language::Syntax::ElseClause>
|
68
79
|
end
|
69
80
|
|
@@ -113,7 +124,7 @@ grammar Gisele::Language::Syntax::Grammar
|
|
113
124
|
end
|
114
125
|
|
115
126
|
rule bool_term
|
116
|
-
bool_paren | bool_lit |
|
127
|
+
bool_paren | bool_lit | var_ref
|
117
128
|
end
|
118
129
|
|
119
130
|
rule bool_paren
|
@@ -126,11 +137,6 @@ grammar Gisele::Language::Syntax::Grammar
|
|
126
137
|
<Gisele::Language::Syntax::BoolLit>
|
127
138
|
end
|
128
139
|
|
129
|
-
rule bool_varref
|
130
|
-
(variable_name)
|
131
|
-
<Gisele::Language::Syntax::VarRef>
|
132
|
-
end
|
133
|
-
|
134
140
|
### Variables
|
135
141
|
|
136
142
|
rule variable_def
|
@@ -151,6 +157,11 @@ grammar Gisele::Language::Syntax::Grammar
|
|
151
157
|
(spaces 'initially' spaces lit:boolean_literal){ lit.value }
|
152
158
|
end
|
153
159
|
|
160
|
+
rule var_ref
|
161
|
+
(variable_name)
|
162
|
+
<Gisele::Language::Syntax::VarRef>
|
163
|
+
end
|
164
|
+
|
154
165
|
### Events
|
155
166
|
|
156
167
|
rule event_set
|
@@ -173,11 +184,11 @@ grammar Gisele::Language::Syntax::Grammar
|
|
173
184
|
end
|
174
185
|
|
175
186
|
rule variable_name
|
176
|
-
[a-z] [A-Za-z0-9_]*
|
187
|
+
!(reserved_word spaces) [a-z] [A-Za-z0-9_]*
|
177
188
|
end
|
178
189
|
|
179
190
|
rule event_name
|
180
|
-
[a-z] [a-z0-9_]*
|
191
|
+
!(reserved_word spaces) [a-z] [a-z0-9_]*
|
181
192
|
end
|
182
193
|
|
183
194
|
### Literals
|
@@ -200,4 +211,26 @@ grammar Gisele::Language::Syntax::Grammar
|
|
200
211
|
(comment | [ \t\n])*
|
201
212
|
end
|
202
213
|
|
203
|
-
|
214
|
+
### Reserved Words
|
215
|
+
rule reserved_word
|
216
|
+
"if"
|
217
|
+
| "else"
|
218
|
+
| "elsif"
|
219
|
+
| "when"
|
220
|
+
| "while"
|
221
|
+
| "seq"
|
222
|
+
| "par"
|
223
|
+
| "task"
|
224
|
+
| "refinement"
|
225
|
+
| "fluent"
|
226
|
+
| "trackvar"
|
227
|
+
| "initially"
|
228
|
+
| "end"
|
229
|
+
| "not"
|
230
|
+
| "or"
|
231
|
+
| "and"
|
232
|
+
| "true"
|
233
|
+
| "false"
|
234
|
+
end
|
235
|
+
|
236
|
+
end
|
@@ -30,7 +30,7 @@ require_relative 'while_st'
|
|
30
30
|
require_relative 'if_st'
|
31
31
|
require_relative 'else_clause'
|
32
32
|
require_relative 'elsif_clause'
|
33
|
-
require_relative '
|
34
|
-
require_relative '
|
33
|
+
require_relative 'case_st'
|
34
|
+
require_relative 'when_clause'
|
35
35
|
require_relative 'task_def'
|
36
|
-
require_relative '
|
36
|
+
require_relative 'unit_def'
|
@@ -5,10 +5,11 @@ module Gisele
|
|
5
5
|
include Node
|
6
6
|
|
7
7
|
def _to_ast
|
8
|
-
name
|
9
|
-
|
10
|
-
ref
|
11
|
-
[:
|
8
|
+
name = captures[:task_name].first.strip
|
9
|
+
defs = captures[:some_def].map{|x| x.to_ast}
|
10
|
+
ref = captures[:explicit_statement].map{|x| x.to_ast}.first
|
11
|
+
ref = [:nop] unless ref
|
12
|
+
[:task_def, name] + defs + [ref]
|
12
13
|
end
|
13
14
|
|
14
15
|
end # module TaskDef
|
@@ -1,14 +1,14 @@
|
|
1
1
|
module Gisele
|
2
2
|
module Language
|
3
3
|
module Syntax
|
4
|
-
module
|
4
|
+
module UnitDef
|
5
5
|
include Node
|
6
6
|
|
7
7
|
def _to_ast
|
8
|
-
[:
|
8
|
+
[:unit_def] + captures[:task_def].map{|x| x.to_ast}
|
9
9
|
end
|
10
10
|
|
11
|
-
end # module
|
11
|
+
end # module UnitDef
|
12
12
|
end # module Syntax
|
13
13
|
end # module Language
|
14
14
|
end # module Gisele
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Gisele
|
2
|
+
module Language
|
3
|
+
module Syntax
|
4
|
+
module WhenClause
|
5
|
+
include Node
|
6
|
+
|
7
|
+
def _to_ast
|
8
|
+
cond = captures[:bool_expr].first.to_ast
|
9
|
+
dost = captures[:process_statement].first.to_ast
|
10
|
+
[:when_clause, cond, dost]
|
11
|
+
end
|
12
|
+
|
13
|
+
end # module WhenClause
|
14
|
+
end # module Syntax
|
15
|
+
end # module Language
|
16
|
+
end # module Gisele
|
@@ -1,31 +1,33 @@
|
|
1
1
|
module Gisele
|
2
2
|
module Language
|
3
|
-
class ToGraph <
|
3
|
+
class ToGraph < Rewriter
|
4
4
|
module Connector; end
|
5
5
|
|
6
|
-
def
|
7
|
-
|
6
|
+
def on_unit_def(node)
|
7
|
+
node.
|
8
|
+
children.
|
9
|
+
select{|n| n.first == :task_def}.
|
10
|
+
map{|taskdef| call(taskdef) }
|
8
11
|
end
|
9
|
-
alias :on_unit :recurse_on_last
|
10
12
|
|
11
13
|
def on_task_def(node)
|
12
14
|
@graph = Yargi::Digraph.new
|
13
|
-
|
15
|
+
|
16
|
+
entry, exit = add_vertex(node), add_vertex(node)
|
17
|
+
|
18
|
+
# flatten all elsif
|
19
|
+
c_entry, c_exit = call(ElsifFlattener.new.call(node.last))
|
20
|
+
connect(entry, c_entry)
|
21
|
+
connect(c_exit, exit)
|
22
|
+
|
14
23
|
@graph.vertices(Connector).each do |vertex|
|
15
24
|
next unless vertex.out_edges.size == 1
|
16
25
|
target = vertex.out_edges.first.target
|
17
26
|
@graph.reconnect(vertex.in_edges, nil, target)
|
18
27
|
@graph.remove_vertex(vertex)
|
19
28
|
end
|
20
|
-
@graph
|
21
|
-
end
|
22
29
|
|
23
|
-
|
24
|
-
entry, exit = add_vertex(node), add_vertex(node)
|
25
|
-
c_entry, c_exit = call(node.last)
|
26
|
-
connect(entry, c_entry)
|
27
|
-
connect(c_exit, exit)
|
28
|
-
[entry, exit]
|
30
|
+
@graph
|
29
31
|
end
|
30
32
|
|
31
33
|
def on_seq_st(node)
|
@@ -50,15 +52,40 @@ module Gisele
|
|
50
52
|
[entry, exit]
|
51
53
|
end
|
52
54
|
|
55
|
+
def on_if_st(node)
|
56
|
+
cond, then_clause, else_clause, = node.children
|
57
|
+
|
58
|
+
entry, exit = entry_and_exit(node)
|
59
|
+
|
60
|
+
diamond = add_vertex(node)
|
61
|
+
connect(entry, diamond)
|
62
|
+
|
63
|
+
c_entry, c_exit = call(then_clause)
|
64
|
+
connect(diamond, c_entry, true_ast_node)
|
65
|
+
connect(c_exit, exit)
|
66
|
+
|
67
|
+
if else_clause
|
68
|
+
c_entry, c_exit = call(else_clause.last)
|
69
|
+
connect(diamond, c_entry, false_ast_node)
|
70
|
+
connect(c_exit, exit)
|
71
|
+
else
|
72
|
+
connect(diamond, exit, false_ast_node)
|
73
|
+
end
|
74
|
+
|
75
|
+
[entry, exit]
|
76
|
+
end
|
77
|
+
|
53
78
|
def on_case_st(node)
|
79
|
+
cond, *clauses = node.children
|
80
|
+
|
54
81
|
entry, exit = entry_and_exit(node)
|
55
82
|
|
56
83
|
diamond = add_vertex(node)
|
57
84
|
connect(entry, diamond)
|
58
85
|
|
59
|
-
|
60
|
-
c_entry, c_exit = call(
|
61
|
-
connect(diamond, c_entry,
|
86
|
+
clauses.each do |clause|
|
87
|
+
c_entry, c_exit = call(clause.last)
|
88
|
+
connect(diamond, c_entry, clause)
|
62
89
|
connect(c_exit, exit)
|
63
90
|
end
|
64
91
|
|
data/lib/gisele/language.rb
CHANGED
@@ -1,8 +1,30 @@
|
|
1
1
|
module Gisele
|
2
2
|
module Language
|
3
3
|
|
4
|
+
require 'yaml'
|
4
5
|
DOT_ATTRIBUTES = YAML.load_file(Path.dir/"language/dot.yml")
|
5
6
|
|
7
|
+
RESERVED_WORDS = [
|
8
|
+
"if",
|
9
|
+
"else",
|
10
|
+
"elsif",
|
11
|
+
"when",
|
12
|
+
"while",
|
13
|
+
"seq",
|
14
|
+
"par",
|
15
|
+
"task",
|
16
|
+
"refinement",
|
17
|
+
"fluent",
|
18
|
+
"trackvar",
|
19
|
+
"initially",
|
20
|
+
"end",
|
21
|
+
"not",
|
22
|
+
"or",
|
23
|
+
"and",
|
24
|
+
"true",
|
25
|
+
"false"
|
26
|
+
]
|
27
|
+
|
6
28
|
def rule2mod(rule)
|
7
29
|
rule.to_s.gsub(/(^|_)([a-z])/){|x| $2.capitalize}.to_sym
|
8
30
|
end
|
@@ -18,6 +40,8 @@ module Gisele
|
|
18
40
|
end # module Gisele
|
19
41
|
require_relative 'language/syntax'
|
20
42
|
require_relative 'language/ast'
|
21
|
-
require_relative 'language/
|
43
|
+
require_relative 'language/rewriter'
|
44
|
+
require_relative 'language/elsif_flattener'
|
45
|
+
require_relative 'language/if_to_case'
|
22
46
|
require_relative 'language/sugar_removal'
|
23
47
|
require_relative 'language/to_graph'
|
data/lib/gisele/version.rb
CHANGED
@@ -1,56 +1,50 @@
|
|
1
1
|
[
|
2
|
-
:
|
2
|
+
:unit_def,
|
3
3
|
[
|
4
4
|
:task_def,
|
5
5
|
"Simple",
|
6
6
|
[
|
7
|
-
:
|
7
|
+
:fluent,
|
8
|
+
"diagKnown",
|
8
9
|
[
|
9
|
-
:
|
10
|
-
"
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
"Treatment:end"
|
18
|
-
],
|
19
|
-
nil
|
20
|
-
]
|
10
|
+
:event_set,
|
11
|
+
"Diagnosis:start"
|
12
|
+
],
|
13
|
+
[
|
14
|
+
:event_set,
|
15
|
+
"Treatment:end"
|
16
|
+
],
|
17
|
+
nil
|
21
18
|
],
|
22
19
|
[
|
23
|
-
:
|
20
|
+
:seq_st,
|
24
21
|
[
|
25
|
-
:
|
22
|
+
:if_st,
|
26
23
|
[
|
27
|
-
:
|
24
|
+
:bool_expr,
|
28
25
|
[
|
29
|
-
:
|
26
|
+
:bool_not,
|
30
27
|
[
|
31
|
-
:
|
32
|
-
|
33
|
-
:var_ref,
|
34
|
-
"diagKnown"
|
35
|
-
]
|
36
|
-
]
|
37
|
-
],
|
38
|
-
[
|
39
|
-
:task_call_st,
|
40
|
-
"Diagnosis"
|
41
|
-
],
|
42
|
-
[
|
43
|
-
:else_clause,
|
44
|
-
[
|
45
|
-
:task_call_st,
|
46
|
-
"NoDiag"
|
28
|
+
:var_ref,
|
29
|
+
"diagKnown"
|
47
30
|
]
|
48
31
|
]
|
49
32
|
],
|
50
33
|
[
|
51
34
|
:task_call_st,
|
52
|
-
"
|
35
|
+
"Diagnosis"
|
36
|
+
],
|
37
|
+
[
|
38
|
+
:else_clause,
|
39
|
+
[
|
40
|
+
:task_call_st,
|
41
|
+
"NoDiag"
|
42
|
+
]
|
53
43
|
]
|
44
|
+
],
|
45
|
+
[
|
46
|
+
:task_call_st,
|
47
|
+
"Treatment"
|
54
48
|
]
|
55
49
|
]
|
56
50
|
]
|
@@ -3,28 +3,38 @@ digraph G {
|
|
3
3
|
V0 [shape="circle" style="filled" fillcolor="black" fixed="true" width="0.1" label=""]
|
4
4
|
V1 [shape="circle" style="filled" fillcolor="black" fixed="true" width="0.1" label=""]
|
5
5
|
V2 [shape="box" label="FirstTask"]
|
6
|
-
V3 [shape="diamond" label=""]
|
6
|
+
V3 [shape="diamond" label="everyoneHappy"]
|
7
7
|
V4 [shape="box" height="0.1" style="filled" fillcolor="black" label=""]
|
8
8
|
V5 [shape="box" height="0.1" style="filled" fillcolor="black" label=""]
|
9
9
|
V6 [shape="box" label="MakeJoy"]
|
10
10
|
V7 [shape="box" label="DrinkBeers"]
|
11
|
-
V8 [shape="
|
12
|
-
V9 [shape="box" label="
|
13
|
-
V10 [shape="
|
14
|
-
V11 [shape="
|
11
|
+
V8 [shape="diamond" label="someoneHappy"]
|
12
|
+
V9 [shape="box" label="DrinkBeer"]
|
13
|
+
V10 [shape="box" label="DoNothingSpecial"]
|
14
|
+
V11 [shape="diamond" label="not(endOfTheDay)"]
|
15
|
+
V12 [shape="diamond" label="curState"]
|
16
|
+
V13 [shape="box" label="DoSomething"]
|
17
|
+
V14 [shape="box" label="DoNothing"]
|
18
|
+
V15 [shape="box" label="WaitAndSee"]
|
15
19
|
V2 -> V3 []
|
16
20
|
V6 -> V5 []
|
17
21
|
V4 -> V6 []
|
18
22
|
V7 -> V5 []
|
19
23
|
V4 -> V7 []
|
20
|
-
V3 -> V4 [label="
|
21
|
-
V5 ->
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
V3 -> V4 [label="true"]
|
25
|
+
V5 -> V11 []
|
26
|
+
V9 -> V11 []
|
27
|
+
V8 -> V9 [label="true"]
|
28
|
+
V10 -> V11 []
|
29
|
+
V8 -> V10 [label="false"]
|
30
|
+
V3 -> V8 [label="false"]
|
31
|
+
V13 -> V11 []
|
32
|
+
V12 -> V13 [label="somethingToDo"]
|
33
|
+
V14 -> V11 []
|
34
|
+
V12 -> V14 [label="nothingToDo"]
|
35
|
+
V15 -> V11 []
|
36
|
+
V12 -> V15 [label="[else]"]
|
37
|
+
V11 -> V1 [label="false"]
|
38
|
+
V11 -> V12 [label="true"]
|
29
39
|
V0 -> V2 []
|
30
40
|
}
|
@@ -26,7 +26,7 @@ DESCRIPTION
|
|
26
26
|
array for automatic processing.
|
27
27
|
|
28
28
|
When --graph is used, the command parses the process file. It then converts the AST into
|
29
|
-
a directed graph representing the process as a box-and-arrow workflow and outputs it on
|
29
|
+
a directed graph representing the process as a box-and-arrow workflow and outputs it on
|
30
30
|
standard output. For now, the only output format available is dot (from graphviz).
|
31
31
|
|
32
32
|
SystemExit
|
@@ -1 +1 @@
|
|
1
|
-
gisele --no-sugar --ast=ruby tasks/
|
1
|
+
gisele --no-sugar --ast=ruby tasks/complete.gis
|