• Aucun résultat trouvé

VI–1.2 Invocation of a model

The invocation of a model of process provides an INSTANCE-OF-PROCESS by macro-expansion of the text of the model, or by reference to this model if the text of the model is defined externally or is compiled separately.

Depending on the fact that a model:

has or not parameters,

has or not inputs,

has or not outputs,

the invocation of the model can take different syntactic forms. In all cases, the composition with the context is done positionally, on the inputs and on the outputs.

If the model has no outputs, and only in this case, its invocation appears as an expression on processes (ELEMENTARY-PROCESS); in any other case, an invocation of model appears as an expression on signals (S-EXPR).

The tableC–VI.1gives the generic forms of the invocation of a model (which can be either an ex-pression on processes or an exex-pression on signals).

Positional definition No inputs of the inputs

Without parameters P(E1,. . . ,En) P( )

With parameters P{V1,. . . ,Vm}(E1,. . . ,En) P{V1,. . . ,Vm}( ) Table C–VI.1: Syntactic forms of an invocation of model

The different forms are detailed below.

1. Context-free syntax

ELEMENTARY-PROCESS ::=

INSTANCE-OF-PROCESS

2-a Macro-expansion of a model

One has to take care that this basic form is used here to describe the semantics of any invocation of model.

The composition with the context is made by identity of names. However, this form is not available as an external form in the language, except if the corresponding model of process does not have inputs.

P{V1,. . . ,Vm}

The static parameters are parenthesized by { and } ; these parameters are types or constant expressions mainly used as initial values of signals or array size. Note that parameters can also be models (cf. partE, sectionXI–8, page187).

1. Context-free syntax

INSTANCE-OF-PROCESS ::=

EXPANSION

| Name-model ( )

EXPANSION ::=

Name-model

{ S-EXPR-PARAMETER { , S-EXPR-PARAMETER } }

S-EXPR-PARAMETER ::=

S-EXPR

| SIGNAL-TYPE

2. Profile

! (

P{V1,. . . ,Vm}

)

is equal to the set of the names of the outputs of the visible declaration ofP, let{Y1, . . . , Yq}.

? (

P{V1,. . . ,Vm }

)

is equal to the set of the names of the inputs of the visible declaration ofP, let{X1, . . . , Xp}.

3. Types

(a) Let, in this order,P1, . . . ,Plbe the names of the formal parameters of the visible declaration ofP.

(b) The actual parameters (S-EXPR-PARAMETER) of the invocation of the model must cor-respond positionally to the formal parameters of the declaration of the model (cf. part E, section XI–5, page 179). In particular, to the parameter types can only correspond types (SIGNAL-TYPE), and to the “constant sequences” parameters can only correspond expres-sions on sequences (S-EXPR).

(c) (

τ (

V1

)

×. . .×

τ (

Vm

)

)v(

τ (

P1

)

×. . .×

τ (

Pl

)

) (d)

τ (

P{V1,. . . ,Vm}

)

=

τ (!

P

)

(cf. partE, sectionXI–5, page179) 4. Semantics

Pbeing the name of a model of visible process, the expressionsV1, . . . ,Vmare the actual pa-rameters of the expansion, corresponding positionally to the formal papa-rameters of this model.

The expansion P{V1,. . . ,Vm}is equivalent to the body of the visible declaration of P in which each formal parameter has been substituted by the corresponding actual parameter.

P( )is the expansion ofP whenP has no parameters.

VI–1. SYSTEMS OF EQUATIONS ON SIGNALS 99

5. Clocks The actual parameters of sequencesVimust be constant expressions.

(a)

ω(

Vi

)

=~

2-b Positional macro-expansion of a model

P{V1,. . . ,Vm}(E1,. . . ,En) or P(E1,. . . ,En) withn≥1

In the external form of the language, the input signals are associated with an instance of model, respecting their “position”: a list of expressions between the symbols ( and ) redefines the input signals declared in the model respecting the order of these declarations.

1. Context-free syntax

INSTANCE-OF-PROCESS ::=

PRODUCTION PRODUCTION ::=

MODEL-REFERENCE ( S-EXPR { , S-EXPR } )

MODEL-REFERENCE ::=

EXPANSION

| Name-model

2. Profile

! (

P{V1,. . . ,Vm }( E1,. . . ,En )

)

is equal to the set of the names of the outputs of the visible declaration ofP, let{Y1, . . . , Yq}.

? (

P{V1,. . . ,Vm} (E1,. . . ,En)

)

= [n i=1

? (

Ei

)

− {Y1, . . . , Yq}. 3. Types

(a) Let, in this order, P1, . . . , Pl be the names of the formal parameters andX1, . . . , Xp the names of the inputs of the visible declaration ofP.

(b) (

τ (

V1

)

×. . .×

τ (

Vm

)

)v(

τ (

P1

)

×. . .×

τ (

Pl

)

) (c) (

τ (

E1

)

×. . .×

τ (

En

)

)v(

τ (

X1

)

×. . .×

τ (

Xp

)

) (d)

τ (

P{V1,. . . ,Vm}(E1,. . . ,En)

)

=

τ (!

P

)

(cf. partE, sectionXI–5, page179) 4. Semantics

The formP(E1,. . . ,En)is used whenP has no parameters.

5. Definition in SIGNAL P{V1,. . . ,Vm}(E1,. . . ,En)

is equal to the process defined below in which{SXi}is a set of signal names that do not belong to the inputs of the expressionsEi(

[n i=1

? (

Ei

)

), or to the sets of input or output names ofP.

(| (SX1,...,SXp) := (E1,...,En)

| (| (X1,...,Xp) := (SX1,...,SXp)

| P{ V1,...,Vm }

|) / X1, ..., Xp

|) / SX1, ..., SXp

6. Clocks The actual parameters of sequencesVimust be constant expressions.

(a)

ω(

Vi

)

=~ 2-c Call of a model

(SS1,. . . ,SSr) :=P{V1,. . . ,Vm}(E1,. . . ,En)

(the formP{V1,. . . ,Vm }(E1,. . . ,En)is used here generically to represent one of the forms defined in2-aor in2-b; moreover, it can also appear as argument of any expression on signals)

1. Context-free syntax S-EXPR ::=

INSTANCE-OF-PROCESS

2. Definition in SIGNAL

(SS1,. . . ,SSr) :=P{V1,. . . ,Vm}(E1,. . . ,En ), with the modelP having the output signals {Y1, . . . , Yq}, is equal to the process defined below in which{SYi}is a set of signal names that do not belong to the inputs of the expressionsEi(

[n i=1

? (

Ei

)

), or to the sets of input or output names ofP, or to the set{SS1, . . . , SSr}.

(| (SS1,...,SSr) := (SY1,...,SYq)

| (| P{ V1,...,Vm }( E1,...,En )

| (SY1,...,SYq) := (Y1,...,Yq)

|) / Y1, ..., Yq

|) / SY1, ..., SYq

The tableC–VI.2gives the different forms of the invocation of a model together with the priority of their arguments (refer to the tablesC–VI.3andC–VI.4).

2-d Expressions of type conversion T(E)

The conversions of values between distinct effective types can be explicited as call of a model (INSTANCE-OF-PROCESS); the name of this model is the name of the destination type of the conver-sion; the expressions of conversion can only appear as expressions on signals, but not as expressions on processes.

1. Context-free syntax

VI–1. SYSTEMS OF EQUATIONS ON SIGNALS 101

Scheme Type

Arguments Result P{V10,. . . ,Vm0 }(E10,. . . ,En0)

P{V10,. . . ,Vm0 }( ) (µ1×. . .×µm)×(ν1×. . .×νn)

P{V10,. . . ,Vm0 } (ρ1×. . .×ρp)

P(E10,. . . ,En0 ) (ν1×. . .×νn) P( )

Table C–VI.2: INSTANCE-OF-PROCESSE25

When the inputsEiare absent, it is a model without input (the tuple ((ν1×. . .×νn)) is then empty);

When the model has at least one input, the typesν10, . . . ,νp0 being, in this order, those of the declaration of the inputs ofP, there is

(ν1×. . .×νn)v(ν10 ×. . .×ν0p)

The typeρiis that of the signal declaration corresponding positionally in output inP.

S-EXPR ::=

CONVERSION CONVERSION ::=

Type-conversion ( S-EXPR )

Type-conversion ::=

Scalar-type

| Name-type

2. Types

(a) If the conversionC

τ (

E

) τ (

T

)

exists,

τ (

T(E)

)

=

τ (

T

)

(b) If the conversionC

τ (

E

)

τ (

T

)

does not exist,T(E)is incorrect.

3. Semantics

Ifvis an element of the sequence of values represented byE, the corresponding element is C

τ (

E

)

τ (

T

)

(v) in the sequence represented byT(E)(if the conversionC

τ (

E

)

τ (

T

)

exists).

If the type T or the type ofE is an external type, the applied conversion, when it exists, depends on the environment while respecting the general rules concerning conversions (cf.

sectionV–6.3, page81).

4. Clocks A conversion is a monochronous expression.

(a)

ω(

T(E)

)

=

ω(

E

)

5. Examples

(a) integer(3.14)has the value3.

Documents relatifs