Skip to content

Commit

Permalink
Added representation for if and when equations.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@1395 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Håkan Lundvall committed Jan 13, 2005
1 parent 12c7b8a commit ceb95ab
Showing 1 changed file with 34 additions and 4 deletions.
38 changes: 34 additions & 4 deletions modeq/dae.rml
Expand Up @@ -73,18 +73,24 @@ module DAE:
| DEFINE of Exp.ComponentRef * Exp.Exp
| INITIALDEFINE of Exp.ComponentRef * Exp.Exp
| EQUATION of Exp.Exp * Exp.Exp
| WHEN_EQUATION of Exp.Exp (* Condition *) *
Element list (* Equations *) *
Element option (* Elsewhen should be of type WHEN_EQUATION*)
| IF_EQUATION of Exp.Exp (* Condition *) *
Element list (* Equations of true branch*) *
Element list (* Equations of false branch*)
| INITIALEQUATION of Exp.Exp * Exp.Exp
| ALGORITHM of Algorithm.Algorithm
| INITIALALGORITHM of Algorithm.Algorithm
| COMP of Ident * DAElist
| FUNCTION of Absyn.Path * DAElist * Types.Type
| EXTFUNCTION of Absyn.Path * DAElist * Types.Type * ExternalDecl
| ASSERT of Exp.Exp
| ASSERT of Exp.Exp

datatype ExtArg = EXTARG of Exp.ComponentRef * Types.Attributes * Types.Type
| EXTARGEXP of Exp.Exp * Types.Type
| EXTARGSIZE of Exp.ComponentRef * Types.Attributes * Types.Type * Exp.Exp
| NOEXTARG
| EXTARGEXP of Exp.Exp * Types.Type
| EXTARGSIZE of Exp.ComponentRef * Types.Attributes * Types.Type * Exp.Exp
| NOEXTARG

datatype ExternalDecl = EXTERNALDECL of Ident * (* external function name *)
ExtArg list * (* parameters *)
Expand Down Expand Up @@ -515,6 +521,30 @@ relation dump_equations_str: Element list => string =
-------------------------------
dump_equations_str( ASSERT(e)::xs) => str

rule Exp.print_exp_str(c) => s &
dump_equations_str(xs1) => s1 &
dump_equations_str(xs2) => s2 &
dump_equations_str(xs) => s3 &
Util.string_append_list([" if ",s," then\n", s1, " else\n", s2,
" end if;\n", s3 ]) => str
-------------------------------
dump_equations_str( IF_EQUATION(c,xs1,xs2)::xs) => str

rule Exp.print_exp_str(c) => s &
dump_equations_str(xs1) => s1 &
dump_equations_str(xs2::xs) => s2 &
Util.string_append_list(["when ",s," then\n", s1, " else", s2]) => str
-------------------------------
dump_equations_str( WHEN_EQUATION(c,xs1,SOME(xs2))::xs) => str


rule Exp.print_exp_str(c) => s &
dump_equations_str(xs1) => s1 &
dump_equations_str(xs) => s3 &
Util.string_append_list(["when ",s," then\n", s1, " end when;\n",s3]) => str
-------------------------------
dump_equations_str( WHEN_EQUATION(c,xs1,NONE)::xs) => str

rule dump_equations_str(xs) => str
-----------------------------
dump_equations_str(_::xs) => str
Expand Down

0 comments on commit ceb95ab

Please sign in to comment.