44 **
55 ** RCS: $Id$
66 **
7- ** This module exports only one relation. *)
7+ ** This module exports only one relation.
8+ **)
89
910module Inst:
1011
@@ -33,9 +34,10 @@ with "staticexp.rml"
3334with "mod.rml"
3435with "rtopts.rml"
3536
36- (** These type aliases are introduced to make the code a little more
37+ (**
38+ ** These type aliases are introduced to make the code a little more
3739 ** readable.
38- ** FIXME: maybe they should be removed? * )
40+ **)
3941
4042type Prefix = Prefix.Prefix
4143type Mod = Mod.Mod
156158 **
157159 ** This rule instantiates the contents of a class definition, with a
158160 ** new environment already setup.
159- **
160- ** FIXME: This relation is just a wrapper around `inst_classdef', and could probably be removed.
161161 **)
162162
163163relation inst_class_in: (Env, Mod, Prefix, Connect.Sets, ClassInf.State,
@@ -175,7 +175,6 @@ relation inst_class_in: (Env, Mod, Prefix, Connect.Sets, ClassInf.State,
175175 c as SCode.CLASS(n,_,r,d), prot)
176176 => (l,env', csets', ci_state', tys)
177177
178- (* FIXME *)
179178 rule print "- inst_class_in failed\n"
180179 ----------------------------------
181180 inst_class_in(_,_,_,csets,_,_,_) => fail
@@ -203,7 +202,6 @@ relation inst_classdef: (Env, Mod, Prefix, Connect.Sets, ClassInf.State,
203202 (** This rule describes how to instantiate an explicit
204203 ** class definition *)
205204
206- (** FIXME: propagate prot *)
207205 rule ClassInf.trans(ci_state, ClassInf.NEWDEF) => ci_state' &
208206 inst_element_list(env,mods,pre,csets,ci_state', els)
209207 => (dae1,env', csets', ci_state'', tys) &
@@ -227,7 +225,6 @@ relation inst_classdef: (Env, Mod, Prefix, Connect.Sets, ClassInf.State,
227225 ClassInf.start(r, cn2) => new_ci_state &
228226 print " deriving from " & Absyn.print_restr r & print " : " &
229227 ClassInf.print_state new_ci_state & print "\n" &
230- (* FIXME order *)
231228 Mod.merge(mods,m) => mods' &
232229 Mod.merge(mods',mod') => mods'' &
233230 inst_class_in(env, mods'', pre, csets, new_ci_state, c, prot)
@@ -317,15 +314,11 @@ relation inst_element : (Env, Mod, Prefix, Connect.Sets, ClassInf.State,
317314 (* classmod is the modifications stored with the class *)
318315 (* mods is the modifications passed to the relation *)
319316 (* m is the modification stored in the element *)
320- (* FIXME: verify order *)
321- (* print " mod 1: " & print cns & Mod.print_mod classmod & print "\n" &
322- print " mod 2: " & print cns & Mod.print_mod mods & print "\n" &
323- print " mod 3: " & print cns & Mod.print_mod m' & print "\n" & *)
324317 Mod.merge(classmod,mods) => mods' &
325318 Mod.merge(mods',m') => mods'' &
326319
327320 (* Can't use inst_class, as that creates a new frame *)
328- inst_class_in(env,mods'',pre,csets,ci_state,c,false(*FIXME: FOO?*) )
321+ inst_class_in(env,mods'',pre,csets,ci_state,c,false)
329322 => (dae,env',csets',ci_state',vars)
330323 ----------------------------------
331324 inst_element(env,mods,pre,csets, ci_state, SCode.EXTENDS(cn,m))
@@ -377,7 +370,6 @@ relation inst_element : (Env, Mod, Prefix, Connect.Sets, ClassInf.State,
377370 ** parameter or constant. All of these are treated in a
378371 ** similar way.
379372 **
380- ** FIXME: doc
381373 ** Lookup the class name, apply modifications and add the
382374 ** variable to the current frame in the environment. Then
383375 ** instantiate the class with an extended prefix.
@@ -386,7 +378,6 @@ relation inst_element : (Env, Mod, Prefix, Connect.Sets, ClassInf.State,
386378 rule Prefix.prefix_cref(pre,Exp.CREF_IDENT(n,[])) => vn &
387379
388380 print " variable " & Exp.print_component_ref vn & print "\n" &
389- (** FIXME: merge order *)
390381
391382 (** The class definition is fetched from the environment. *)
392383 (** Then the set of modifications is calculated. The *)
@@ -434,10 +425,6 @@ relation inst_element : (Env, Mod, Prefix, Connect.Sets, ClassInf.State,
434425 print " extended frame with variable " & Exp.print_component_ref vn &
435426 print " :: " & Types.print_type ty & print "\n" &
436427
437- (** If the modification includes an equation, it is added. *)
438- (* FIXME: use env or env'? *)
439- (* inst_mod_equation(env',pre,n,ty,mod') => dae2 & *)
440-
441428 (** If the type is one of the simple, predifined types a *)
442429 (** simple variable declaration is added to the DAE. *)
443430 (* dae_declare (vn,cl,attr) => dae3 & *)
@@ -451,7 +438,7 @@ relation inst_element : (Env, Mod, Prefix, Connect.Sets, ClassInf.State,
451438 attr as SCode.ATTR(ad,flow,acc,param,dir),
452439 t,m))
453440 => (dae, env',csets',ci_state,
454- [Types.VAR(n,SCode.ATTR([(* FIXME: why? *) ],flow,acc,param,dir),
441+ [Types.VAR(n,SCode.ATTR([],flow,acc,param,dir),
455442 prot, ty, binding)])
456443
457444
@@ -493,7 +480,7 @@ relation inst_var : (Env.Env,Mod.Mod,Prefix.Prefix,Connect.Sets,Ident,
493480
494481 rule list_reverse idxs => idxs' &
495482 Prefix.prefix_add(n,idxs',pre) => pre' &
496- (** FIXME: Redeclarations! *)
483+ (* This is where redeclare should be handled *)
497484 inst_class(env,mod,pre',csets,cl) => (dae1,csets',ty,st) &
498485
499486 Exp.int_subscripts idxs' => subs &
@@ -534,7 +521,7 @@ relation inst_array : (Env.Env,Mod.Mod,Prefix.Prefix,Connect.Sets,Ident,
534521
535522 rule Mod.lookup_idx_modification(mod,i) => mod' &
536523 print " modification[]: " & Mod.print_mod mod' & print "\n" &
537- inst_var(env,mod',pre,csets,n,cl,attr,NONE(*FIXME*) ,dims,i::idxs)
524+ inst_var(env,mod',pre,csets,n,cl,attr,NONE,dims,i::idxs)
538525 => (dae1,csets',ty) &
539526 int_add(i,1) => i' &
540527 inst_array(env,mod,pre,csets',n,(cl,attr),i',stop,dims,idxs)
@@ -886,8 +873,6 @@ relation inst_equation : (Env,Mod, Prefix, Connect.Sets, ClassInf.State,
886873 => ([],env,csets',ci_state')
887874
888875 (** assert
889- **
890- ** FIXME: Handle assertions
891876 **)
892877
893878 rule Static.elab_exp(env,e) => (e', Static.PROP(t, c)) &
969954 ** Equations follow the same typing rules as equality expressions.
970955 ** This relation adds the equation to the DAE.
971956 **
972- ** FIXME: type conversions (use Static.match_prop)
973957 **)
974958
975959relation inst_eq_equation : (Exp.Exp, Static.Properties,
1003987
1004988(** relation: inst_eq_equation_2
1005989 **
1006- ** FIXME: doc
990+ ** This is the second stage of `inst_eq_equation', when the types are
991+ ** checked.
1007992 **)
1008993
1009994relation inst_eq_equation_2 : (Exp.Exp, Exp.Exp, Types.Type)
@@ -1085,7 +1070,8 @@ end
10851070
10861071(** relation: inst_array_equation
10871072 **
1088- ** FIXME: doc
1073+ ** This checks the array size and uses `inst_array_el_eq' to create
1074+ ** equations for each array element.
10891075 **)
10901076
10911077relation inst_array_equation : (Exp.Exp, Exp.Exp,
@@ -1110,7 +1096,8 @@ end
11101096
11111097(** relation: inst_array_el_eq
11121098 **
1113- ** FIXME: doc
1099+ ** This relation loops recursively through all indexes in the two
1100+ ** arrays and generates an equation for each pair of elements.
11141101 **)
11151102
11161103relation inst_array_el_eq : (Exp.Exp, Exp.Exp, Types.Type, int, int)
@@ -1138,7 +1125,8 @@ end
11381125
11391126(** relation: inst_assertion
11401127 **
1141- ** Instantiate an assertion.
1128+ ** Instantiate an assertion. There are not assertions in the output
1129+ ** currently.
11421130 **)
11431131
11441132relation inst_assertion : (Env.Env, Exp.Exp, Types.Type,
@@ -1149,13 +1137,13 @@ relation inst_assertion : (Env.Env, Exp.Exp, Types.Type,
11491137 print " (constant) ASSERTION(" & Exp.print_exp e' & print "): " &
11501138 print d & print "\n"
11511139 --------------------
1152- inst_assertion (env, e, Types.T_BOOL, true, d, pre) => [(*FIXME *)]
1140+ inst_assertion (env, e, Types.T_BOOL, true, d, pre) => [(* lost *)]
11531141
11541142 rule Prefix.prefix_exp(env,e,pre) => e' &
11551143 print " ASSERTION(" & Exp.print_exp e' & print "): " &
11561144 print d & print "\n"
11571145 --------------------
1158- inst_assertion (env, e, Types.T_BOOL, _, d, pre) => [(*FIXME *)]
1146+ inst_assertion (env, e, Types.T_BOOL, _, d, pre) => [(* lost *)]
11591147
11601148 rule print "# Assertions have to be of type Boolean\n" &
11611149 print " assertion: (" &
@@ -1342,7 +1330,6 @@ end
13421330 ** This relation tests whether a type is a eligible to be used in
13431331 ** connections.
13441332 **
1345- ** FIXME: It is unknown whether `Real' is a valid connector.
13461333 **)
13471334
13481335relation valid_connector : Types.Type => () =
@@ -1364,7 +1351,6 @@ end
13641351 ** Check that the type and type attributes of two connectors match,
13651352 ** so that they really may be connected.
13661353 **
1367- ** FIXME: This checks the `flow' attribute on the top variable. This depends on whether connections are allowed on Reals.
13681354 **)
13691355
13701356relation check_connect_types : (Exp.ComponentRef, Types.Type,
@@ -1570,7 +1556,6 @@ relation component_face : Exp.ComponentRef => Connect.Face =
15701556 rule print "# While connecting " &
15711557 Exp.print_component_ref c & print "\n" &
15721558 print "# Only local or child connectors allowed.\n"
1573- (* FIXME: This only checks the syntactic properties. *)
15741559 ---------------------------------------------------
15751560 component_face c => fail
15761561
@@ -1626,7 +1611,6 @@ end
16261611 ** If the component being declared is declared to be constant, the
16271612 ** relation `make_const_binding' is used.
16281613 **
1629- ** FIXME: Why is the result from make_const_binding ignored?
16301614 **)
16311615
16321616relation make_binding : (Env.Env, SCode.Attributes, Mod.EqMod option, SCode.Class)
@@ -1635,8 +1619,6 @@ relation make_binding : (Env.Env, SCode.Attributes, Mod.EqMod option, SCode.Clas
16351619 axiom make_binding (_,_,NONE,_) => Types.UNBOUND
16361620
16371621 rule print " constant binding: " & Exp.print_exp e & print "\n" &
1638- class_type cl => ct &
1639- make_const_binding (env,e, prop, ct) => binding
16401622 ----------------------------------------
16411623 make_binding (env,
16421624 SCode.ATTR(_,_,_,Absyn.CONST,_),
@@ -1682,18 +1664,3 @@ relation make_const_binding : (Env.Env, Exp.Exp, Static.Properties,
16821664 make_const_binding(_,_,_,_) => fail
16831665
16841666end
1685-
1686- (** relation: class_type *)
1687-
1688- relation class_type : SCode.Class => Types.Type =
1689-
1690- axiom class_type SCode.CLASS(_,_,Absyn.R_PREDEFINED_INT,_) => Types.T_INTEGER
1691- axiom class_type SCode.CLASS(_,_,Absyn.R_PREDEFINED_STRING,_)
1692- => Types.T_STRING
1693- axiom class_type SCode.CLASS(_,_,Absyn.R_PREDEFINED_REAL,_) => Types.T_REAL
1694- axiom class_type SCode.CLASS(_,_,Absyn.R_PREDEFINED_BOOL,_) => Types.T_BOOL
1695-
1696- (* FIXME: Should instantiate the class *)
1697- axiom class_type _ => Types.T_COMPLEX(ClassInf.UNKNOWN("---"),[(* FIXME *)])
1698-
1699- end
0 commit comments