Skip to content

Commit

Permalink
- changes to Absyn, SCode, DAE, Env!
Browse files Browse the repository at this point in the history
- Absyn.mo + Parser/Modelica.g 
  + fixed some of the weird naming
- SCode.mo 
  + SCode.Class is gone, SCode.Program is now a list of elements
  + SCode.Attributes are now in DERIVED instead of Absyn.ElementAttributes
  + grouped the element prefixes into SCode.Prefixes and put them both in SCode.CLASS and SCode.COMPONENT
  + added visibility attribute to all Elements (extends, import, etc)!
  + replaced some false/true flags with real records for easier following of patterns or expressions.
- DAE.mo
  + use flags instead of false/true
- Env.mo
  + better naming for fields
- SCodeHashTable.mo
  + new file to help with SCodeFlattenExtends.mo
  + more to come here.


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@8656 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Apr 15, 2011
1 parent 47b0b5f commit 769d813
Show file tree
Hide file tree
Showing 51 changed files with 4,986 additions and 3,116 deletions.
7 changes: 4 additions & 3 deletions Compiler/BackEnd/PartFn.mo
Expand Up @@ -521,7 +521,7 @@ algorithm
DAE.ComponentRef cref;
DAE.VarKind kind;
DAE.VarDirection direction;
DAE.VarProtection protection;
DAE.VarVisibility protection;
DAE.Type ty;
Option<DAE.Exp> binding;
DAE.InstDims dims;
Expand Down Expand Up @@ -1244,7 +1244,8 @@ algorithm
case(DAE.VAR(componentRef = cref,ty = ty))
equation
i = ComponentReference.printComponentRefStr(cref);
res = DAE.TYPES_VAR(i,DAE.ATTR(false,false,SCode.RO(),SCode.VAR(),Absyn.INPUT(),Absyn.UNSPECIFIED()),false,ty,DAE.UNBOUND(),NONE()); // TODO: FIXME: binding?
// TODO: FIXME: binding?
res = DAE.TYPES_VAR(i,DAE.ATTR(SCode.NOT_FLOW(),SCode.NOT_STREAM(),SCode.RO(),SCode.VAR(),Absyn.INPUT(),Absyn.NOT_INNER_OUTER()),SCode.PUBLIC(),ty,DAE.UNBOUND(),NONE());
then
res;
case(_)
Expand Down Expand Up @@ -1388,7 +1389,7 @@ algorithm
DAE.ComponentRef componentRef " The variable name";
DAE.VarKind kind "varible kind: variable, constant, parameter, discrete etc." ;
DAE.VarDirection direction "input, output or bidir" ;
DAE.VarProtection protection "if protected or public";
DAE.VarVisibility protection "if protected or public";
DAE.Type ty "Full type information required";
DAE.Exp binding "Binding expression e.g. for parameters ; value of start attribute" ;
DAE.InstDims dims "dimensions";
Expand Down
13 changes: 6 additions & 7 deletions Compiler/BackEnd/SimCode.mo
Expand Up @@ -979,7 +979,7 @@ algorithm
matchcontinue (inCache,inEnv,className,inInteractiveSymbolTable,inFileNamePrefix,addDummy, inSimSettingsOpt)
local
String filenameprefix,file_dir,resstr;
list<SCode.Class> p_1;
list<SCode.Element> p_1;
DAE.DAElist dae;
list<Env.Frame> env;
BackendDAE.BackendDAE dlow,dlow_1,indexed_dlow,indexed_dlow_1;
Expand Down Expand Up @@ -1056,7 +1056,7 @@ algorithm
matchcontinue (inCache,inEnv,className,inInteractiveSymbolTable,inFileNamePrefix,addDummy, inSimSettingsOpt)
local
String filenameprefix,file_dir,resstr;
list<SCode.Class> p_1;
list<SCode.Element> p_1;
DAE.DAElist dae;
list<Env.Frame> env;
BackendDAE.BackendDAE dlow,dlow_1,indexed_dlow,indexed_dlow_1;
Expand Down Expand Up @@ -1235,7 +1235,7 @@ algorithm
matchcontinue (inCache,inEnv,className,inInteractiveSymbolTable,inFileNamePrefix,addDummy, inSimSettingsOpt)
local
String filenameprefix,file_dir,resstr;
list<SCode.Class> p_1;
list<SCode.Element> p_1;
DAE.DAElist dae;
list<Env.Frame> env;
BackendDAE.BackendDAE dlow,dlow_1,indexed_dlow,indexed_dlow_1;
Expand Down Expand Up @@ -3162,16 +3162,15 @@ Helper function to elaborateRecordDeclarations."
output list<RecordDeclaration> outRecordDecls;
output list<String> outReturnTypes;
algorithm
(outRecordDecls,outReturnTypes) :=
matchcontinue (inRecordTypes,inAccRecordDecls,inReturnTypes)
(outRecordDecls,outReturnTypes) := matchcontinue (inRecordTypes,inAccRecordDecls,inReturnTypes)
local
Types.Type ty;
list<Types.Var> rest;
list<String> rt,rt_1,rt_2;
list<RecordDeclaration> accRecDecls;
case ({},accRecDecls,rt)
then (accRecDecls,rt);
case (DAE.TYPES_VAR(type_ = (ty as (DAE.T_COMPLEX(complexClassType = ClassInf.RECORD(_)),_)))::rest,accRecDecls,rt)
case (DAE.TYPES_VAR(ty = (ty as (DAE.T_COMPLEX(complexClassType = ClassInf.RECORD(_)),_)))::rest,accRecDecls,rt)
equation
(accRecDecls,rt_1) = elaborateRecordDeclarationsForRecord(ty,accRecDecls,rt);
(accRecDecls,rt_2) = elaborateNestedRecordDeclarations(rest,accRecDecls,rt_1);
Expand Down Expand Up @@ -8876,7 +8875,7 @@ algorithm
Types.Type typesType;
DAE.ExpType expType;
DAE.ComponentRef cref_;
case (DAE.TYPES_VAR(name=name, type_=typesType))
case (DAE.TYPES_VAR(name=name, ty=typesType))
equation
expType = Types.elabType(typesType);
cref_ = ComponentReference.makeCrefIdent(name, expType, {});
Expand Down
42 changes: 21 additions & 21 deletions Compiler/FrontEnd/Absyn.mo
Expand Up @@ -406,14 +406,14 @@ uniontype ElementSpec "An element is something that occurs in a public or protec
end ElementSpec;

public
uniontype InnerOuter "One of the keyword inner and outer CAN be given to reference an inner or
outer component. Thus there are three disjoint possibilities."
record INNER "an inner component" end INNER;
record OUTER "an outer component" end OUTER;
record INNEROUTER "an inner/outer component" end INNEROUTER;
record UNSPECIFIED "a component without inner/outer" end UNSPECIFIED;
uniontype InnerOuter
"One of the keyword inner and outer CAN be given to reference an
inner or outer element. Thus there are three disjoint possibilities."
record INNER "an inner prefix" end INNER;
record OUTER "an outer prefix" end OUTER;
record INNER_OUTER "an inner outer prefix" end INNER_OUTER;
record NOT_INNER_OUTER "no inner outer prefix" end NOT_INNER_OUTER;
end InnerOuter;

public
uniontype Import "Import statements, different kinds"
// A named import is a import statement to a variable ex;
Expand Down Expand Up @@ -634,19 +634,19 @@ end EqMod;
public
uniontype ElementArg "Wrapper for things that modify elements, modifications and redeclarations"
record MODIFICATION
Boolean finalItem "finalItem" ;
Each each_ "each" ;
ComponentRef componentRef "componentRef" ;
Option<Modification> modification "modification" ;
Option<String> comment "comment" ;
Boolean finalPrefix "final prefix";
Each eachPrefix "each";
ComponentRef componentRef "componentRef";
Option<Modification> modification "modification";
Option<String> comment "comment";
end MODIFICATION;

record REDECLARATION
Boolean finalItem "finalItem" ;
RedeclareKeywords redeclareKeywords "redeclare or replaceable " ;
Each each_ "each" ;
ElementSpec elementSpec "elementSpec" ;
Option<ConstrainClass> constrainClass "class definition or declaration" ;
Boolean finalPrefix "final prefix";
RedeclareKeywords redeclareKeywords "redeclare or replaceable ";
Each eachPrefix "each prefix";
ElementSpec elementSpec "elementSpec";
Option<ConstrainClass> constrainClass "class definition or declaration";
Info info "needed because ElementSpec does not contain this info; Element does";
end REDECLARATION;

Expand Down Expand Up @@ -4800,12 +4800,12 @@ end getFileNameFromInfo;
public function isOuter
"@author: adrpo
this function returns true if the given Absyn.InnerOuter
is one of Absyn.INNEROUTER() or Absyn.OUTER()"
is one of Absyn.INNER_OUTER() or Absyn.OUTER()"
input InnerOuter io;
output Boolean isItAnOuter;
algorithm
isItAnOuter := matchcontinue(io)
case (INNEROUTER()) then true;
case (INNER_OUTER()) then true;
case (OUTER()) then true;
case (_) then false;
end matchcontinue;
Expand All @@ -4814,12 +4814,12 @@ end isOuter;
public function isInner
"@author: adrpo
this function returns true if the given Absyn.InnerOuter
is one of Absyn.INNEROUTER() or Absyn.INNER()"
is one of Absyn.INNER_OUTER() or Absyn.INNER()"
input InnerOuter io;
output Boolean isItAnInner;
algorithm
isItAnInner := matchcontinue(io)
case (INNEROUTER()) then true;
case (INNER_OUTER()) then true;
case (INNER()) then true;
case (_) then false;
end matchcontinue;
Expand Down

0 comments on commit 769d813

Please sign in to comment.