/
Interactive.rml
5830 lines (4785 loc) · 221 KB
/
Interactive.rml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(*
Copyright (c) PELAB, Dept. Computer and Information Science, Linkoping University,
Sweden, in the following denoted PELAB/LIU.
This file is part of OpenModelica, in the following denoted OSM.
The OSM License, Version 1.1, March 4, 2005.
1 Preface
The aim of this license is to lay down the conditions enabling you to use,
modify and circulate OSM. However, PELAB/LIU remain the authors of
OSM and so retain property rights and the use of all ancillary rights.
2 Definitions
OSM is defined as all successive versions of the OSM software and their
documentation that have been developed by PELAB/LIU and including
accepted contributions from other contributors according to this license.
OSM DERIVED SOFTWARE is defined as all or part of OSM that you have
modified and/or translated and/or adapted.
3 Dual License
OSM is made available under the OSM licensing scheme, which is a dual
licensing scheme with two options, a) and b):
a) OSM OPEN SOURCE LICENSE:
If you wish to write Open Source software you can use the Open Source version
of OSM, released under the OSM license which include GPL as its open source
licensing option. If you use the OSM Open Source version you must release your
Application using OSM including this Application's source code under the GPL as well.
This OSM license text, and Copyright (c) PELAB/Linkoping University, must
be present in your copy of OSM and in OSM DERIVED SOFTWARE.
You should have received a copy of the GPL - GNU General Public License
along with OpenModelica; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
b) OSM COMMERCIAL LICENSE
If you are using OSM commercially - that is, for commercial usage or
for creating proprietary software for sale or use in a commercial setting
- you must purchase a commercial license of OSM from PELAB/LIU, which allows
you to use OSM without releasing your Application under the GPL.
Comment: Payments for OSM are intended for OSM development and
integration of accepted contributions into OSM.
4 Priority
If there is any conflict between this OSM License text and the GNU GPL
license, this text has priority.
5 Contributions
PELAB/LIU reserves the right to accept or turn down source code contributions
to OSM.
6 Limitation of the warranty
Except when mentioned otherwise in writing, OSM is supplied as is, with
no explicit or implicit warranty, including warranties of commercialization or
adaptation. You assume all risks concerning the quality or the effects of
OSM and its use. If OSM is defective, you will bear the costs of
all required services, corrections or repairs.
7 Consent
When you access and use OSM, you are presumed to be aware of and to
have accepted all the rights and obligations of the present OSM license.
This includes accepting that your open source code contributions to OSM,
if accepted into OSM by PELAB/IDA, follow the OSM licensing rules including
copyright and ownership by PELAB/IDA.
8 Binding effect
This license has the binding value of a contract.
You are not responsible for respect of the license by a third party.
9 Applicable law
The present license and its effects are subject to Swedish law and
Swedish courts.
10 Contact information
See http://www.ida.liu.se/~pelab/modelica/OpenModelica.html
*)
(* $Id$ *)
(**
** This module contain functionality for model management, expression evaluation, etc.
** in the interactive environment.
** The module defines a symboltable used in the interactive environment containing:
** - Modelica models (described using Absyn AST)
** - Variable bindings
** - Compiled functions (so they do not need to be recompiled)
** - Instantiated classes (that can be reused, not impl. yet)
** - Modelica models in SCode form (to speed up instantiation. not impl. yet)
**)
module Interactive:
with "Absyn.rml"
with "SCode.rml"
with "DAE.rml"
with "Types.rml"
with "Values.rml"
with "Env.rml"
datatype InteractiveStmt = IALG of Absyn.AlgorithmItem
| IEXP of Absyn.Exp
datatype InteractiveStmts = ISTMTS of InteractiveStmt list *
bool (* true if output result == no semicolon*)
datatype InstantiatedClass = INSTCLASS of Absyn.Path * (* The F.Q.name of the inst:ed class*)
DAE.Element list (* The list of DAE elements *)
* Env.Env (* The env of the inst:ed class*)
datatype InteractiveVariable = IVAR of Absyn.Ident * (* The variable identifier *)
Values.Value * (* The expression containing the value *)
Types.Type (* The type of the expression *)
datatype InteractiveSymbolTable = SYMBOLTABLE of Absyn.Program * (*The ast*)
SCode.Program * (* The exploded ast *)
InstantiatedClass list * (* List of instantiated classes*)
InteractiveVariable list * (*List of variables with values*)
(Absyn.Path * Types.Type) list (* List of compiled functions, F.Q name + type*)
relation evaluate: (InteractiveStmts, InteractiveSymbolTable, bool)
=> (string,InteractiveSymbolTable)
relation update_program: (Absyn.Program,Absyn.Program) => Absyn.Program
relation update_scope: (Absyn.Program, InteractiveVariable list) => InteractiveVariable list
relation add_component: (string,Absyn.ComponentRef,Absyn.ComponentRef,Absyn.NamedArg list, Absyn.Program) => (Absyn.Program,string)
relation get_component_count: (Absyn.ComponentRef,Absyn.Program) => int
relation remove_compiled_functions: (Absyn.Program, (Absyn.Path * Types.Type) list)
=> (Absyn.Path * Types.Type) list
relation build_env_from_symboltable: (InteractiveSymbolTable) => Env.Env
relation get_pathed_class_in_program: (Absyn.Path, Absyn.Program) => Absyn.Class
relation get_type_of_variable: (Absyn.Ident, InteractiveVariable list) => Types.Type
relation add_instantiated_class: (InstantiatedClass list, InstantiatedClass) => InstantiatedClass list
relation get_instantiated_class: (InstantiatedClass list, Absyn.Path) => InstantiatedClass
relation get_contained_class_and_file: (Absyn.Path, Absyn.Program) => (Absyn.Program, string)
relation add_var_to_symboltable: (Absyn.Ident, Values.Value, Types.Type,InteractiveSymbolTable)
=> InteractiveSymbolTable
relation add_scope: (Absyn.Program, InteractiveVariable list) => Absyn.Program
relation is_primitive: (Absyn.ComponentRef, Absyn.Program) => bool
relation get_elementitems_in_class: (Absyn.Class) => Absyn.ElementItem list
relation get_components_in_class: (Absyn.Class) => Absyn.Element list
relation get_classnames_in_elts: (Absyn.ElementItem list) => string list
relation get_component_name_and_type_and_comment: (Absyn.Element,Env.Env) => string list
relation get_components: (Absyn.ComponentRef,Absyn.Program) => string
relation is_primitive_class: (Absyn.Class,Absyn.Program) => bool
relation get_componentitems_name: Absyn.ComponentItem list => string list
(* this is added for optimization of modeleditor*)
relation get_top_classnames: (Absyn.Program) => string
relation get_component_modification: Absyn.Element => string
relation add_to_public: (Absyn.Class, Absyn.ElementItem) => Absyn.Class
relation traverse_classes: (Absyn.Program,
((Absyn.Class * 'a) => (Absyn.Class * 'a)), (* rel-ation to apply*)
'a, (* extra value passed to re-lation*)
bool) (* true = traverse protected elements*)
=> (Absyn.Program* 'a)
relation is_package: (Absyn.ComponentRef, Absyn.Program) => bool
end
with "Dump.rml"
with "Debug.rml"
with "RTOpts.rml"
with "Util.rml"
with "Parser.rml"
with "Prefix.rml"
with "Mod.rml"
with "Lookup.rml"
with "ClassInf.rml"
with "Exp.rml"
with "Inst.rml"
with "Static.rml"
with "ModUtil.rml"
with "Codegen.rml"
with "Print.rml"
with "System.rml"
with "ClassLoader.rml"
with "Ceval.rml"
val Placement_records = "record Transformation Real x=0.0; Real y=0.0; Real scale=1.0; Real aspectRatio=1.0; Boolean flipHorizontal=false; Boolean flipVertical=false; Real rotation=0.0; end Transformation; record Placement Boolean visible=true; Transformation transformation; Transformation iconTransformation; end Placement;"
val Line_records = "type LinePattern=enumeration(None,Solid,Dash,Dot,DashDot,DashDotDot); type Arrow=enumeration(None,Open,Filled,Half); record Line Boolean visible=true; Real points[:,2]; Integer color[3]={0,0,0}; LinePattern pattern = LinePattern.Solid; Real thickness=0.25; Arrow arrow[2]={Arrow.None,Arrow.None}; Real arrowSize = 3.0; Boolean smooth=false; end Line;"
val Icon_records = "record GraphicItem Boolean visible=true; end GraphicItem; record CoordinateSystem Real extent[2,2]; end CoordinateSystem; record Icon CoordinateSystem coordinateSystem(extent ={{-10.0, -10.0}, {10.0, 10.0}}); /*GraphicItem graphics[:];*/ end Icon;"
val Diagram_records = "record GraphicItem Boolean visible=true; end GraphicItem; record CoordinateSystem Real extent[2,2]; end CoordinateSystem; record Diagram CoordinateSystem coordinateSystem(extent ={{-100.0, -100.0}, {100.0, 100.0}}); /*GraphicItem graphics[:];*/ end Diagram;"
(* This variable contains all records needed for the graphical primitives, such as Line, Ellipse, etc. *)
val Graphics_records = "type LinePattern=enumeration(None,Solid,Dash,Dot,DashDot,DashDotDot); type Arrow=enumeration(None,Open,Filled,Half); type FillPattern=enumeration(None,Solid,Horizontal,Vertical,Cross,Forward,Backward,CrossDiag,HorizontalCylinder,VerticalCylinder,Sphere); type BorderPattern=enumeration(None,Raised,Sunken,Engraved); type TextStyle=enumeration(Bold,Italic,Underline); record Line Boolean visible=true; Real points[:,2]; Integer color[3]={0,0,0}; LinePattern pattern = LinePattern.Solid; Real thickness=0.25; Arrow arrow[2]={Arrow.None,Arrow.None}; Real arrowSize = 3.0; Boolean smooth=false; end Line; record Polygon Boolean visible=true;Integer lineColor[3]={0,0,0};Integer fillColor[3]={0,0,0}; LinePattern pattern=LinePattern.Solid; FillPattern fillPattern=FillPattern.None; Real lineThickness=0.25; Real points[:,2]; Boolean smooth=false; end Polygon; record Rectangle Boolean visible=true;Integer lineColor[3]={0,0,0};Integer fillColor[3]={0,0,0}; LinePattern pattern=LinePattern.Solid; FillPattern fillPattern=FillPattern.None; Real lineThickness=0.25; BorderPattern borderPattern=BorderPattern.None; Real extent[2,2]; Real radius=0.0; end Rectangle; record Ellipse Boolean visible=true;Integer lineColor[3]={0,0,0};Integer fillColor[3]={0,0,0}; LinePattern pattern=LinePattern.Solid; FillPattern fillPattern=FillPattern.None; Real lineThickness=0.25; Real extent[2,2]; end Ellipse; record Text Boolean visible=true;Integer lineColor[3]={0,0,0};Integer fillColor[3]={0,0,0}; LinePattern pattern=LinePattern.Solid; FillPattern fillPattern=FillPattern.None; Real lineThickness=0.25; Real extent[2,2]; String textString; Real fontSize = 0.0; String fontName=\"\"; TextStyle textStyle[:]; end Text; record Bitmap Boolean visible=true; Real extent[2,2]; String fileName=\"\"; String imageSource=\"\"; end Bitmap;"
(** relation: evaluate
** This relation evaluates expressions feeded interactively to the compiler.
**)
relation evaluate: (InteractiveStmts, InteractiveSymbolTable, bool)
=> (string,InteractiveSymbolTable) =
rule evaluate2(ISTMTS([x],true),st) => (res,newst)
----------------------------
evaluate (ISTMTS([x],true),st,false) => ("",newst)
rule (* Verbose, semicolon off *)
evaluate2(ISTMTS([x],false),st) => (res,newst)
----------------------------
evaluate (ISTMTS([x],true),st,true) => (res,newst)
rule evaluate2(ISTMTS([x],false),st) => (res,newst)
----------------------------
evaluate (ISTMTS([x],false),st,verbose) => (res,newst)
rule evaluate2(ISTMTS([x],sc),st) => (res,newst) &
evaluate(ISTMTS(xs,sc),newst,false) => (res,newst')
------------------------------------------
evaluate (ISTMTS(x::xs,sc),st,false) => (res,newst')
rule evaluate2(ISTMTS([x],sc),st) => (res,newst) &
evaluate(ISTMTS(xs,sc),newst,true) => (res2,newst') &
Util.string_append_list([res,res2]) => res'
------------------------------------------
evaluate (ISTMTS(x::xs,sc),st,true) => (res',newst')
end
relation evaluate2: (InteractiveStmts, InteractiveSymbolTable) => (string,InteractiveSymbolTable) =
rule get_variable_names(vars) => vars &
string_append(vars,"\n") => str
--------------------------
evaluate2(ISTMTS([IEXP(Absyn.CALL(Absyn.CREF_IDENT("listVariables",_),Absyn.FUNCTIONARGS([],[])))],_),st as SYMBOLTABLE(_,_,_,vars,_))
=> (str,st)
rule evaluate_graphical_api(stmts,st) => (str,newst) &
string_append(str,"\n") => str'
----------------------------------------------------
evaluate2(stmts as ISTMTS([IEXP(Absyn.CALL(_,_))],_),st) => (str',newst)
rule evaluate_expr(exp,st) => (s1,newst) &
string_append(s1,"\n") => str
------------------------------------------------------
evaluate2(stmts as ISTMTS([exp],_),st) => (str,newst)
axiom evaluate2(_,st) => ("Not implemented yet\n",st)
end
(** relation: evaluate_expr
** This relation takes an 'InteractiveStmt´ and a symboltable and
** evaluates the expression using Staticexp.
**)
relation evaluate_expr: (InteractiveStmt, InteractiveSymbolTable) =>
(string,InteractiveSymbolTable) =
rule build_env_from_symboltable(st) => env &
Static.elab_exp(env,exp,true,SOME(st)) => (sexp,prop,SOME(st')) &
Ceval.ceval (env,sexp,true,SOME(st'),NONE) => (value,SOME(st'')) &
Values.val_string value => str
-------------------------------
evaluate_expr(IEXP(exp),st as SYMBOLTABLE(p,_,_,_,_)) => (str,st'')
rule build_env_from_symboltable(st) => env &
not Static.elab_exp(env,exp,true,SOME(st)) => (sexp,prop,SOME(st'))
-------------------------------
evaluate_expr(IEXP(exp),st as SYMBOLTABLE(p,_,_,_,_)) => fail
rule build_env_from_symboltable(st) => env &
Static.elab_exp(env,exp,true,SOME(st)) => (sexp,prop,SOME(st')) &
not Ceval.ceval (env,sexp,true,SOME(st'),NONE) => (_,_)
-------------------------------
evaluate_expr(IEXP(exp),st as SYMBOLTABLE(p,_,_,_,_)) => fail
rule build_env_from_symboltable(st) => env &
Static.elab_exp(env,cond,true,SOME(st))
=> (econd,prop,SOME(st')) &
Ceval.ceval (env,econd,true,SOME(st'),NONE)
=> (Values.BOOL(true),SOME(st''))
-----------------------------------------------
evaluate_expr(IALG(Absyn.ALGORITHMITEM(Absyn.ALG_NORETCALL(Absyn.CREF_IDENT("assert",_),Absyn.FUNCTIONARGS([cond,msg],_)),_)),st as SYMBOLTABLE(p,_,_,_,_))
=> ("", st'')
rule build_env_from_symboltable(st) => env &
Static.elab_exp(env,msg,true,SOME(st))
=> (msg',prop,SOME(st')) &
Ceval.ceval (env,msg',true,SOME(st'),NONE)
=> (Values.STRING(str),SOME(st''))
-----------------------------------------------
evaluate_expr(IALG(Absyn.ALGORITHMITEM(Absyn.ALG_NORETCALL(Absyn.CREF_IDENT("assert",_),Absyn.FUNCTIONARGS([cond,msg],_)),_)),st as SYMBOLTABLE(p,_,_,_,_))
=> (str, st'')
rule build_env_from_symboltable(st) => env &
Static.elab_exp(env,exp,true,SOME(st)) => (sexp,Types.PROP(t,_),SOME(st')) &
Ceval.ceval(env,sexp,true,SOME(st'),NONE) => (value,SOME(st'')) &
Values.val_string value => str &
add_var_to_symboltable(ident,value,t,st'') => newst
-----------------------------------------------
evaluate_expr(IALG(Absyn.ALGORITHMITEM(Absyn.ALG_ASSIGN(Absyn.CREF_IDENT(ident,[]),exp),_)),st as SYMBOLTABLE(p,_,_,_,_))
=> (str, newst)
(* Since expressions cannot be tuples an empty string is returned *)
rule build_env_from_symboltable(st) => env &
Static.elab_exp(env,rexp,true,SOME(st)) => (srexp,rprop,SOME(st')) &
Types.get_prop_type rprop => ((Types.T_TUPLE(types),_)) &
Util.list_map(crefexps, get_ident_from_crefexp) => idents &
Ceval.ceval(env,srexp,true,SOME(st'),NONE) => (Values.TUPLE(values), SOME(st'')) &
add_vars_to_symboltable(idents,values,types,st'') => newst
-----------------------------------------------
evaluate_expr(IALG(Absyn.ALGORITHMITEM(Absyn.ALG_TUPLE_ASSIGN(Absyn.TUPLE(crefexps),rexp),_)),st as SYMBOLTABLE(p,_,_,_,_))
=> ("", newst)
rule Print.get_error_string() => s1 & Print.clear_error_buf() & string_append("Error evaluating expr.\n",s1) => str &
Debug.fprint ("failtrace", "#-- evaluate_expr failed:") &
Debug.fcall ("failtrace", Dump.dump_istmt, ISTMTS([stmt], true)) &
Debug.fprintln ("failtrace", "\n")
-----------------------------
evaluate_expr(stmt,st) => (str,st)
end
relation get_ident_from_crefexp : Absyn.Exp => Absyn.Ident =
axiom get_ident_from_crefexp Absyn.CREF(Absyn.CREF_IDENT(id, _)) => id
rule Print.print_error_buf "# Not a component reference in tuple assignment:\n# " &
Dump.print_exp_str exp => str &
Print.print_error_buf str &
Print.print_error_buf "\n"
--------------------
get_ident_from_crefexp exp => fail
end
relation get_variable_names: (InteractiveVariable list) => string =
rule get_variable_list_str(vars) => strlst &
Util.string_delimit_list(strlst,", ") => str &
Util.string_append_list(["{",str,"}"]) => res
---------------------------------------------
get_variable_names(vars) => res
end
relation get_variable_list_str: (InteractiveVariable list) => string list =
axiom get_variable_list_str([]) => []
rule get_variable_list_str(vs)=> res
----------------------------
get_variable_list_str(IVAR(p,_,_)::vs) => p::res
end
relation get_type_of_variable: (Absyn.Ident, InteractiveVariable list) => Types.Type =
axiom get_type_of_variable(id,[]) => fail
rule varid = id
----------------------------------------------
get_type_of_variable (varid,IVAR(id,_,tp)::rest) => tp
rule not varid = id &
get_type_of_variable(varid,rest) => tp
----------------------------------------------
get_type_of_variable (varid,IVAR(id,_,_)::rest) => tp
end
relation add_vars_to_symboltable: (Absyn.Ident list, Values.Value list,
Types.Type list, InteractiveSymbolTable)
=> InteractiveSymbolTable =
axiom add_vars_to_symboltable ([],_,_,st) => st
rule add_var_to_symboltable (id, v, t, st) => st' &
add_vars_to_symboltable(idrest, vrest, trest, st') => st''
-------------------------------------------------------------
add_vars_to_symboltable (id::idrest, v::vrest, t::trest, st) => st''
end
relation add_var_to_symboltable: (Absyn.Ident, Values.Value, Types.Type,InteractiveSymbolTable)
=> InteractiveSymbolTable =
rule add_var_to_varlist(ident,v,t,vars) => vars'
----------------------------
add_var_to_symboltable(ident,v,t,SYMBOLTABLE(p,sp,id,vars,cf))
=> SYMBOLTABLE(p,sp,id,vars',cf)
end
relation add_var_to_varlist: (Absyn.Ident, Values.Value, Types.Type,
InteractiveVariable list)
=> InteractiveVariable list =
rule ident = id2
-----------
add_var_to_varlist(ident,v,t,IVAR(id2,_,_)::rest)
=> IVAR(ident,v,t)::rest
rule not ident = id2 &
add_var_to_varlist(ident,v,t,rest) => rest'
------------------------------------
add_var_to_varlist(ident,v,t,IVAR(id2,val2,t2)::rest)
=> IVAR(id2,val2,t2)::rest'
axiom add_var_to_varlist(ident,v,t,[]) => [IVAR(ident,v,t)]
end
(** relation: build_env_from_symboltable
** author: PA
**
** Builds an environment from a symboltable by adding all interactive variables
** and their bindings to the environment.
**)
relation build_env_from_symboltable: (InteractiveSymbolTable) => Env.Env =
rule SCode.elaborate(p) => p' &
Inst.make_env_from_program(p',Absyn.IDENT("")) => env &
add_vars_to_env(vars,env) => env'
------------------------------------------
build_env_from_symboltable(SYMBOLTABLE(p,sp,ic,vars,cf)) => env'
end
relation add_vars_to_env: (InteractiveVariable list, Env.Env) => Env.Env =
rule Lookup.lookup_var (env,Exp.CREF_IDENT(id,[])) => (_,_,_) &
Env.update_frame_v(env,
Types.VAR(
id,
Types.ATTR(false,SCode.RW,SCode.VAR,Absyn.BIDIR),
false,
tp,
Types.VALBOUND(v)
),false) => env' &
add_vars_to_env(rest,env') => env''
---------------------------------------
add_vars_to_env (IVAR(id,v,tp)::rest,env) => env''
rule not Lookup.lookup_var (env,Exp.CREF_IDENT(id,[])) => (_,_,_) &
Env.extend_frame_v(env,
Types.VAR(
id,
Types.ATTR(false,SCode.RW,SCode.VAR,Absyn.BIDIR),
false,
tp,
Types.VALBOUND(v)
),NONE,false) => env' &
add_vars_to_env(rest,env') => env''
---------------------------------------
add_vars_to_env (IVAR(id,v,tp)::rest,env) => env''
axiom add_vars_to_env([],env) => env
end
(** relation: evaluate_graphical_api
** This relation evaluates all primitives in the graphical api.
**)
relation evaluate_graphical_api: (InteractiveStmts, InteractiveSymbolTable) =>
(string, InteractiveSymbolTable) =
rule get_source_file(class,p) => resstr
--------------------------------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getSourceFile",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class)],[])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf))
=> (resstr,st)
rule set_source_file(class,filename,p) => (resstr,newp)
--------------------------------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("setSourceFile",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class),
Absyn.STRING(filename)
],[])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf))
=> (resstr,SYMBOLTABLE(newp,s,ic,iv,cf))
rule set_extends_modifier_value(class,Absyn.CREF_IDENT(ident,[]),
subident,mod,p)
=> (newp,resstr)
--------------------------------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("setExtendsModifierValue",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class),
Absyn.CREF(Absyn.CREF_QUAL(ident,_,subident)),
Absyn.CODE(Absyn.C_MODIFICATION(mod))
],[])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf))
=> (resstr,SYMBOLTABLE(newp,s,ic,iv,cf))
rule get_extends_modifier_names(class,ident,p) => resstr
--------------------------------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getExtendsModifierNames",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class),Absyn.CREF(ident)],[])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule get_extends_modifier_value(class,Absyn.CREF_IDENT(ident,[]),subident,p) => resstr
--------------------------------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getExtendsModifierValue",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class),Absyn.CREF(Absyn.CREF_QUAL(ident,_,subident))],[])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule get_component_modifier_names(class,ident,p) => resstr
--------------------------------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getComponentModifierNames",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class),Absyn.CREF(ident)],[])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule get_component_modifier_value(class,Absyn.CREF_IDENT(ident,[]),subident,p)
=> resstr
--------------------------------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getComponentModifierValue",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class),Absyn.CREF(Absyn.CREF_QUAL(ident,_,subident))],[])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule get_parameter_value(class,Absyn.CREF_IDENT(ident,[]),p) => resstr
--------------------------------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getComponentModifierValue",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class),Absyn.CREF(Absyn.CREF_IDENT(ident,_))],[])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule (* expressions *)
set_parameter_value(class,ident,exp,p) => (p',resstr)
--------------------------------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("setComponentModifierValue",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class),
Absyn.CREF(ident as Absyn.CREF_IDENT(_,_)),
Absyn.CODE(Absyn.C_MODIFICATION(Absyn.CLASSMOD(_,SOME(exp))))
],[])))],_),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,SYMBOLTABLE(p',s,ic,iv,cf))
rule (* special case for clearing modifier *)
set_component_modifier(class,ident,Absyn.CREF_IDENT("",[]),mod,p)
=> (p',resstr)
--------------------------------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("setComponentModifierValue",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class),
Absyn.CREF(ident as Absyn.CREF_IDENT(_,_)),
Absyn.CODE(Absyn.C_MODIFICATION(mod as Absyn.CLASSMOD([],NONE)))
],[])))],_),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,SYMBOLTABLE(p',s,ic,iv,cf))
rule set_component_modifier(class,Absyn.CREF_IDENT(ident,[]),subident,mod,p)
=> (p',resstr)
--------------------------------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("setComponentModifierValue",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class),
Absyn.CREF(Absyn.CREF_QUAL(ident,_,subident)),
Absyn.CODE(Absyn.C_MODIFICATION(mod))
],[])))],_),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,SYMBOLTABLE(p',s,ic,iv,cf))
rule get_parameter_value(class,ident,p) => resstr
--------------------------------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getParameterValue",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class),Absyn.CREF(ident)],[])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule set_parameter_value(class,ident,exp,p) => (p',resstr)
---------------------------------------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("setParameterValue",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class),Absyn.CREF(ident),exp],[])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,SYMBOLTABLE(p',s,ic,iv,cf))
rule get_parameter_names(cr,p) => resstr
-----------------------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getParameterNames",_),
Absyn.FUNCTIONARGS([Absyn.CREF(cr)],[])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule update_program(
Absyn.PROGRAM([Absyn.CLASS(name,false,false,false,Absyn.R_MODEL,Absyn.PARTS([Absyn.PUBLIC([])],NONE),"NoFile")],Absyn.TOP),
p) => newp &
let newst = SYMBOLTABLE(newp,s,ic,iv,cf)
----------------------------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("createModel",_),
Absyn.FUNCTIONARGS([Absyn.CREF(Absyn.CREF_IDENT(name,_))],[])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => ("true",newst)
rule Absyn.cref_to_path(path) => path' &
Absyn.path_last_ident(path') => name &
Absyn.strip_last(path') => wpath &
update_program(
Absyn.PROGRAM([Absyn.CLASS(name,false,false,false,Absyn.R_MODEL,Absyn.PARTS([Absyn.PUBLIC([])],NONE),"NoFile")],Absyn.WITHIN(wpath)),p) => newp &
let newst = SYMBOLTABLE(newp,s,ic,iv,cf)
---------------------------------------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("createModel",_),
Absyn.FUNCTIONARGS([Absyn.CREF(path as Absyn.CREF_QUAL(_,_,_))],[])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => ("true",newst)
rule Absyn.cref_to_path(cr) => path &
update_program(
Absyn.PROGRAM([Absyn.CLASS(name,false,false,false,Absyn.R_MODEL,Absyn.PARTS([Absyn.PUBLIC([])],NONE),"NoFile")],Absyn.WITHIN(path)),
p) => newp &
let newst = SYMBOLTABLE(newp,s,ic,iv,cf) &
string_append(name,"\n") => resstr
---------------------------------------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("newModel",_),
Absyn.FUNCTIONARGS( [Absyn.CREF(Absyn.CREF_IDENT(name,_)),Absyn.CREF(cr)] , [])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => ("true",newst)
rule System.regular_file_exist(name) => 0 &
Parser.parse(name) => p1 &
update_program(p1,p) => newp &
get_top_classnames(p1) => top_names_str
---------------------------------------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("loadFileInteractive",_),
Absyn.FUNCTIONARGS( [Absyn.STRING(name)] ,[])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (top_names_str,SYMBOLTABLE(newp,s,ic,iv,cf))
(** it the rule above have failed then check if file exists **)
(* without this omc crashes *)
rule System.regular_file_exist(name) => rest &
int_gt(rest,0) => true
---------------------------------------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("loadFileInteractive",_),
Absyn.FUNCTIONARGS( [Absyn.STRING(name)] ,[])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => ("error",st)
(*check if the parse went wrong*)
rule not Parser.parse(name) => p1
---------------------------------------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("loadFileInteractive",_),
Absyn.FUNCTIONARGS( [Absyn.STRING(name)] ,[])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => ("error",st)
rule delete_class(cr,p) => (resstr, newp)
---------------------------------------------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("deleteClass",_),
Absyn.FUNCTIONARGS([Absyn.CREF(cr)], [])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,SYMBOLTABLE(newp,s,ic,iv,cf))
rule add_component(name,tp,model,nargs,p) => (newp,resstr)
& Print.get_string() => str & string_append(resstr,str) => resstr'
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("addComponent",_),
Absyn.FUNCTIONARGS([Absyn.CREF(Absyn.CREF_IDENT(name,_)),Absyn.CREF(tp),Absyn.CREF(model)],nargs)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => ("true",SYMBOLTABLE(newp,s,ic,iv,cf))
rule (*delete_component(name,model,p) => (newp,resstr) &
add_component(name,tp,model,nargs,newp) => (newp2,resstr)*)
update_component(name,tp,model,nargs,p) =>(newp, res)
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("updateComponent",_),
Absyn.FUNCTIONARGS([Absyn.CREF(Absyn.CREF_IDENT(name,_)),Absyn.CREF(tp),Absyn.CREF(model)],nargs)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (res, SYMBOLTABLE(newp,s,ic,iv,cf))
rule delete_component(name,model,p) => (newp,resstr)
& Print.get_string() => str & string_append(resstr,str) => resstr'
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("deleteComponent",_),
Absyn.FUNCTIONARGS([Absyn.CREF(Absyn.CREF_IDENT(name,_)),Absyn.CREF(model)],nargs)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => ("true",SYMBOLTABLE(newp,s,ic,iv,cf))
rule add_class_annotation(cr,nargs,p) => newp &
let newst = SYMBOLTABLE(newp,s,ic,iv,cf)
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("addClassAnnotation",_),
Absyn.FUNCTIONARGS([Absyn.CREF(cr)],nargs)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => ("true",newst)
rule get_component_count(cr,p) => count &
int_string count => resstr
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getComponentCount",_),
Absyn.FUNCTIONARGS([Absyn.CREF(cr)],_)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule get_nth_component(cr,p,n) => resstr
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getNthComponent",_),
Absyn.FUNCTIONARGS([Absyn.CREF(cr),Absyn.INTEGER(n)],_)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule get_components(cr,p) => resstr
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getComponents",_),
Absyn.FUNCTIONARGS([Absyn.CREF(cr)],_)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule get_component_annotations(cr,p) => resstr
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getComponentAnnotations",_),
Absyn.FUNCTIONARGS([Absyn.CREF(cr)],_)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule get_nth_component_annotation(cr,p,n) => resstr
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getNthComponentAnnotation",_),
Absyn.FUNCTIONARGS([Absyn.CREF(cr),Absyn.INTEGER(n)],_)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule get_nth_component_modification(cr,p,n) => resstr
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getNthComponentModification",_),
Absyn.FUNCTIONARGS([Absyn.CREF(cr),Absyn.INTEGER(n)],_)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule get_inheritance_count(cr,p) => count &
int_string count => resstr
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getInheritanceCount",_),
Absyn.FUNCTIONARGS([Absyn.CREF(cr)],_)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule get_nth_inherited_class(cr,n,p) => resstr
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getNthInheritedClass",_),
Absyn.FUNCTIONARGS([Absyn.CREF(cr),Absyn.INTEGER(n)],_)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule get_connection_count(cr,p) => resstr
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getConnectionCount",_),
Absyn.FUNCTIONARGS([Absyn.CREF(cr)],_)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule get_nth_connection(cr,p,n) => resstr
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getNthConnection",_),
Absyn.FUNCTIONARGS([Absyn.CREF(cr),Absyn.INTEGER(n)],_)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule add_connection(cr,c1,c2,nargs,p) => (resstr,newp)
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("addConnection",_),
Absyn.FUNCTIONARGS([Absyn.CREF(c1),Absyn.CREF(c2),Absyn.CREF(cr)],nargs)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,SYMBOLTABLE(newp,s,ic,iv,cf))
rule delete_connection(cr,c1,c2,p) => (resstr,newp)
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("deleteConnection",_),
Absyn.FUNCTIONARGS([Absyn.CREF(c1),Absyn.CREF(c2),Absyn.CREF(cr)],_)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,SYMBOLTABLE(newp,s,ic,iv,cf))
rule delete_connection(cr,c1,c2,p) => (s1,newp) &
add_connection(cr,c1,c2,nargs,newp) => (resstr,newp')
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("updateConnection",_),
Absyn.FUNCTIONARGS([Absyn.CREF(c1),Absyn.CREF(c2),Absyn.CREF(cr)],nargs)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,SYMBOLTABLE(newp',s,ic,iv,cf))
rule get_nth_connection_annotation(cr,p,n) => resstr
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getNthConnectionAnnotation",_),
Absyn.FUNCTIONARGS([Absyn.CREF(cr),Absyn.INTEGER(n)],_)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule get_connector_count(cr,p) => resstr
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getConnectorCount",_),
Absyn.FUNCTIONARGS([Absyn.CREF(cr)],_)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule get_nth_connector(cr,p,n) => resstr
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getNthConnector",_),
Absyn.FUNCTIONARGS([Absyn.CREF(cr),Absyn.INTEGER(n)],_)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule get_nth_connector_icon_annotation(cr,p,n) => resstr
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getNthConnectorIconAnnotation",_),
Absyn.FUNCTIONARGS([Absyn.CREF(cr),Absyn.INTEGER(n)],_)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule Absyn.cref_to_path(cr) => path &
get_icon_annotation(path,p) => resstr
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getIconAnnotation",_),
Absyn.FUNCTIONARGS([Absyn.CREF(cr)],_)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule Absyn.cref_to_path(cr) => path &
get_diagram_annotation(path,p) => resstr
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getDiagramAnnotation",_),
Absyn.FUNCTIONARGS([Absyn.CREF(cr)],_)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule Absyn.cref_to_path(cr) => path &
get_packages_in_path(path,p) => resstr
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getPackages",_),
Absyn.FUNCTIONARGS([Absyn.CREF(cr)],_)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule get_top_packages(p) => s1 &
string_append(s1,"\n") => resstr
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getPackages",_),
Absyn.FUNCTIONARGS([],_)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule Absyn.cref_to_path(cr) => path &
get_classnames_in_path(path,p) => resstr
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getClassNames",_),
Absyn.FUNCTIONARGS([Absyn.CREF(cr)],_)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule get_top_classnames(p) => resstr
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getClassNames",_),
Absyn.FUNCTIONARGS([],_)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule is_primitive(cr,p) => b1 &
Util.bool_string(b1) => resstr
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("isPrimitive",_),
Absyn.FUNCTIONARGS([Absyn.CREF(cr)],_)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule is_type(cr,p) => b1 &
Util.bool_string(b1) => resstr
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(