Skip to content

Commit

Permalink
Doc fixes and some minor code cleanups.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@453 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
x97davka committed Sep 28, 1998
1 parent 5ff6e65 commit 0ac4484
Show file tree
Hide file tree
Showing 18 changed files with 634 additions and 504 deletions.
1 change: 1 addition & 0 deletions modeq/absyn.rml
@@ -1,5 +1,6 @@
(**
** file: absyn.rml
** module: Absyn
** description: Abstract syntax
**
** RCS: $Id$
Expand Down
15 changes: 8 additions & 7 deletions modeq/algorithm.rml
@@ -1,5 +1,6 @@
(**
** file: algorithm.rml
** module: Algorithm
** description: Algorithm datatypes
**
** RCS: $Id$
Expand Down Expand Up @@ -27,16 +28,16 @@ module Algorithm:
| FOR of Ident * Exp.Exp * Statement list
| WHILE of Exp.Exp * Statement list
| WHEN of Exp.Exp * Statement list
(** There are four kinds of statements. Assignments (`a := b;'), *)
(** if statements (`if A then B; elseif C; else D;'), for loops *)
(** (`for i in 1:10 loop ...; end for;') and when statements (`when *)
(** E do S; end when;'). *)
(** There are four kinds of statements. Assignments (`a := b;'),
** if statements (`if A then B; elseif C; else D;'), for loops
** (`for i in 1:10 loop ...; end for;') and when statements
** (`when E do S; end when;'). *)

datatype Else = NOELSE
| ELSEIF of Exp.Exp * Statement list * Else
| ELSE of Statement list
(** An if statements can one or more `elseif' branches and an *)
(** optional `else' branch. *)
(** An if statements can one or more `elseif' branches and an
** optional `else' branch. *)

relation make_assignment : (Exp.Exp, Static.Properties,
Exp.Exp, Static.Properties,
Expand Down Expand Up @@ -155,7 +156,7 @@ relation make_else : ((Exp.Exp * Static.Properties * Statement list) list,

end

(** relation: make_if *)
(** relation: make_for *)

relation make_for : (Ident, Exp.Exp, Static.Properties,
Statement list) => Statement =
Expand Down
30 changes: 21 additions & 9 deletions modeq/builtin.rml
@@ -1,10 +1,15 @@
(**
** file: builtin.rml
** module: Builtin
** description: Builting types and variables
**
** RCS: $Id$
**
** The only exported relation is `initial_env'.
** This module defines the builtin types, variables and functions in
** Modelica. The only exported relation is `initial_env'.
**
** Currently, the only attribute defined in the built-in types is
** `unit'. The others can easily be added.
**)

module Builtin:
Expand Down Expand Up @@ -40,8 +45,8 @@ val str_type = SCode.CLASS("StringType",false,Absyn.R_PREDEFINED_STRING,
SCode.PARTS([],[],[]))
val bool_type = SCode.CLASS("BooleanType",false,Absyn.R_PREDEFINED_BOOL,
SCode.PARTS([],[],[]))

(** - The `Real' type *)
(** These are the primitive types that are used to build the types
** `Real', `Integer' etc. *)

val unit = SCode.COMPONENT("unit",true,false,
SCode.ATTR([],
Expand All @@ -51,13 +56,15 @@ val unit = SCode.COMPONENT("unit",true,false,
Absyn.BIDIR),
Absyn.IDENT("StringType"),
SCode.MOD(false,[],SOME(Absyn.STRING(""))))
(** This `unit' component is used in several places below, and it is
** declared once here to make the definitions below easier to read. *)

(** - The `Real' type *)

val real_type =
SCode.CLASS("Real",false,Absyn.R_PREDEFINED_REAL,
SCode.PARTS
([(* quantity *)
unit],
(* displayUnit *)
([unit],
[],
[]))

Expand All @@ -66,9 +73,7 @@ SCode.CLASS("Real",false,Absyn.R_PREDEFINED_REAL,
val integer_type =
SCode.CLASS("Integer",false,Absyn.R_PREDEFINED_INT,
SCode.PARTS
([(* quantity *)
unit],
(* displayUnit *)
([unit],
[],
[]))

Expand Down Expand Up @@ -115,6 +120,13 @@ val real_real2bool = Types.T_FUNCTION([("x",Types.T_REAL),("y",Types.T_REAL)],

(** - Initial environment *)

(** relation: initial_env
**
** The initial environment where instantiation takes place is built
** up using this relation. It creates an empty environment and adds
** all the built-in definitions to it.
**)

relation initial_env =

rule Env.open_scope(Env.empty_env) => env1 &
Expand Down
1 change: 1 addition & 0 deletions modeq/classinf.rml
@@ -1,5 +1,6 @@
(**
** file: classinf.rml
** module: ClassInf
** description: Class restrictions
**
** RCS: $Id$
Expand Down

0 comments on commit 0ac4484

Please sign in to comment.