A program in the subset Elan-1 is an Elan <#2860#>program<#2860#> consisting
of one <#2861#>main-packet<#2861#> only.
(315,040)<#4605#>
(000,030)<#4321#>program<#4321#>
16
(000,010)<#4322#>(1,0)<#2863#>030<#2863#><#4655#>#tex2html_wrap5865#(060,010)<#4656#>main-packet<#4656#><#4655#>
(1,0)<#2866#>030<#2866#><#4322#>
17
<#4605#>
We assume the reader to be familiar with the notation of syntax-diagrams.
We use those diagrams not only for describing structure but also
for introducing useful terminology. For didactic reasons, there
will be a large number of relatively simple syntax-diagrams rather
than a small number of complicated ones.
The structure of the <#2867#>main-packet<#2867#> is somewhat simpler than it
is defined by the standard.
(315,050)<#4606#>
(000,040)<#4323#>main-packet<#4323#>
18
(000,020)<#4324#>(1,0)<#2869#>030<#2869#><#4658#>#tex2html_wrap5881#(070,010)<#4659#>bottom-up-part<#4659#><#4658#>
(1,0)<#2872#>030<#2872#><#4661#>#tex2html_wrap5885#(040,010)<#4662#>root<#4662#><#4661#>
(1,0)<#2875#>030<#2875#><#4664#>#tex2html_wrap5889#(070,010)<#4665#>top-down-part<#4665#><#4664#>
(1,0)<#2878#>030<#2878#><#4324#>
19
(005,010)<#2879#>(20,20)[rt]<#2879#>
(025,010)<#2880#>(20,20)[lb]<#2880#>
(025,000)<#4325#>(1,0)<#2881#>080<#2881#><#4325#>
(105,010)<#2882#>(20,20)[rb]<#2882#>
(125,010)<#2883#>(20,20)[lt]<#2883#>
20
(175,010)<#2884#>(20,20)[rt]<#2884#>
(195,010)<#2885#>(20,20)[lb]<#2885#>
(195,000)<#4326#>(1,0)<#2886#>080<#2886#><#4326#>
(275,010)<#2887#>(20,20)[rb]<#2887#>
(295,010)<#2888#>(20,20)[lt]<#2888#>
21
<#4606#>
The <#2889#>root<#2889#> of the <#2890#>packet<#2890#> is either (as in standard Elan) a
<#2891#>paragraph<#2891#> or (as in Elan-0) a <#2892#>refinement<#2892#>.
The effect of the execution of
an Elan-1 program is the effect of the execution of its <#2893#>bottom-up-part<#2893#>
followed by the execution of its <#2894#>root<#2894#>, which may in its turn
involve the execution of some <#2895#>refinements<#2895#> in the <#2896#>top-down-part<#2896#>.
(315,060)<#4607#>
(000,050)<#4327#>root<#4327#>
22
(000,030)<#4328#>(1,0)<#2898#>030<#2898#><#4667#>#tex2html_wrap5917#(060,010)<#4668#>refinement<#4668#><#4667#>
(1,0)<#2901#>030<#2901#><#4328#>
23
(005,020)<#2902#>(20,20)[rt]<#2902#>
(025,020)<#2903#>(20,20)[lb]<#2903#>
(025,010)<#4329#>(1,0)<#2904#>005<#2904#><#4670#>#tex2html_wrap5921#(060,010)<#4671#>paragraph<#4671#><#4670#>
(1,0)<#2907#>005<#2907#><#4329#>
(095,020)<#2908#>(20,20)[rb]<#2908#>
(115,020)<#2909#>(20,20)[lt]<#2909#>
24
<#4607#>
If the <#2910#>root<#2910#> of the program is a <#2911#>paragraph<#2911#>, it is treated by the
Elan Programming Environment as an unnamed <#2912#>refinement<#2912#>, which
obtains the name <#2913#>program<#2913#>.
(315,110)<#4608#>
(000,100)<#4330#>bottom-up-part<#4330#>
25
(000,080)<#4331#>(1,0)<#2915#>060<#2915#><#4673#>#tex2html_wrap5941#(100,010)<#4674#>procedure-declaration<#4674#><#4673#>
(1,0)<#2918#>030<#2918#> <#4680#>(010,010)<#4683#>;<#4683#><#4680#> (010,010)
(1,0)<#2921#>030<#2921#><#4331#>
26
(025,070)<#2922#>(20,20)[lt]<#2922#>
(015,070)<#4332#>(0,-1)<#2923#>60<#2923#><#4332#>
(025,010)<#2924#>(20,20)[lb]<#2924#>
(025,000)<#4333#>(1,0)<#2925#>180<#2925#><#4333#>
(205,010)<#2926#>(20,20)[rb]<#2926#>
(215,010)<#4334#>(0,1)<#2927#>60<#2927#><#4334#>
(205,070)<#2928#>(20,20)[rt]<#2928#>
27
(035,070)<#2929#>(20,20)[rt]<#2929#>
(045,070)<#4335#>(0,-1)<#2930#>40<#2930#><#4335#>
28
(185,070)<#2931#>(20,20)[lt]<#2931#>
(175,070)<#4336#>(0,-1)<#2932#>40<#2932#><#4336#>
29
(055,070)<#2933#>(20,20)[lb]<#2933#>
(055,060)<#4337#>(1,0)<#2934#>005<#2934#><#4685#>#tex2html_wrap5951#(100,010)<#4686#>operator-declaration<#4686#><#4685#>
(1,0)<#2937#>005<#2937#><#4337#>
(165,070)<#2938#>(20,20)[rb]<#2938#>
30
(055,050)<#2939#>(20,20)[lb]<#2939#>
(055,040)<#4338#>(1,0)<#2940#>005<#2940#><#4688#>#tex2html_wrap5955#(100,010)<#4689#>type-declaration<#4689#><#4688#>
(1,0)<#2943#>005<#2943#><#4338#>
(165,050)<#2944#>(20,20)[rb]<#2944#>
31
(055,030)<#2945#>(20,20)[lb]<#2945#>
(055,020)<#4339#>(1,0)<#2946#>005<#2946#><#4691#>#tex2html_wrap5959#(100,010)<#4692#>synonym-declaration<#4692#><#4691#>
(1,0)<#2949#>005<#2949#><#4339#>
(165,030)<#2950#>(20,20)[rb]<#2950#>
32
<#4608#>
The <#2951#>bottom-up-part<#2951#> comprises those <#2952#>declarations<#2952#> which precede
the <#2953#>root<#2953#> and can be considered as a language fundament on which
the rest of the program is to be built.
(315,050)<#4609#>
(000,040)<#4340#>top-down-part<#4340#>
33
(000,020)<#4341#>(1,0)<#2955#>030<#2955#> <#4698#>(010,010)<#4701#>.<#4701#><#4698#> (010,010)
(1,0)<#2958#>030<#2958#><#4703#>#tex2html_wrap5983#(060,010)<#4704#>refinement<#4704#><#4703#>
(1,0)<#2961#>030<#2961#><#4341#>
34
(025,010)<#2962#>(20,20)[l]<#2962#>
(025,000)<#4342#>(1,0)<#2963#>110<#2963#><#4342#>
(135,010)<#2964#>(20,20)[r]<#2964#>
35
<#4609#>
The <#2965#>top-down-part<#2965#> comprises the <#2966#>refinements<#2966#> that can be invoked
from the <#2967#>root<#2967#>. The <#2968#>refinements<#2968#> in the <#2969#>top-down-part<#2969#> can not be
invoked from a <#2970#>declaration<#2970#> in the <#2971#>bottom-up-part<#2971#>.
The Elan Programming Environment accepts as input any sequence
of <#2972#>declarations<#2972#>, other <#2973#>units<#2973#> and <#2974#>refinements<#2974#> and distributes
those elements over the three components of the <#2975#>main-packet<#2975#> in
their order of arrival. Therefore the layout and order of input
to the Elan Programming Environment can be in a very relaxed
syntactic style. In outputting the program the Elan Programming
Environment imparts its own strict layout conventions and structure
to the program.
(315,040)<#4610#>
(000,030)<#4343#>refinement<#4343#>
36
(000,010)<#4344#>(1,0)<#2977#>030<#2977#><#4706#>#tex2html_wrap6019#(040,010)<#4707#>name<#4707#><#4706#>
(1,0)<#2980#>030<#2980#> <#4713#>(010,010)<#4716#>:<#4716#><#4713#> (010,010)
(1,0)<#2983#>030<#2983#><#4718#>#tex2html_wrap6029#(060,010)<#4719#>paragraph<#4719#><#4718#>
(1,0)<#2986#>030<#2986#><#4344#>
37
<#4610#>
A <#2987#>refinement<#2987#> gives a <#2988#>name<#2988#> to a <#2989#>paragraph<#2989#>.
It is invoked by executing its <#2990#>name<#2990#>.
It is not a <#2991#>declaration<#2991#> in the proper sense, since
it may be invoked (e.g. from the <#2992#>root<#2992#>) before it has been executed.
The meaning (effect and value) of a <#2993#>refinement<#2993#> invocation is
the same as that of its <#2994#>paragraph<#2994#>.
(315,070)<#4611#>
(000,060)<#4345#>paragraph<#4345#>
38
(000,040)<#4346#>(1,0)<#2996#>060<#2996#><#4721#>#tex2html_wrap6057#(040,010)<#4722#>unit<#4722#><#4721#>
(1,0)<#2999#>060<#2999#><#4346#>
39
(105,030)<#3000#>(20,20)[r]<#3000#>
(105,020)<#4347#>(-1,0)<#3001#>020<#3001#><#4347#>
(055,020)<#4348#>(1,0)<#3002#>020<#3002#> <#4728#>(010,010)<#4731#>;<#4731#><#4728#> (010,010) <#4348#>
(055,030)<#3005#>(20,20)[l]<#3005#>
40
(005,030)<#3006#>(20,20)[rt]<#3006#>
(015,030)<#4349#>(0,-1)<#3007#>20<#3007#><#4349#>
(025,010)<#3008#>(20,20)[lb]<#3008#>
(025,000)<#4350#>(1,0)<#3009#>110<#3009#><#4350#>
(135,010)<#3010#>(20,20)[rb]<#3010#>
(145,010)<#4351#>(0,1)<#3011#>20<#3011#><#4351#>
(155,030)<#3012#>(20,20)[lt]<#3012#>
41
<#4611#>
The effect of the execution of a <#3013#>paragraph<#3013#> is the effect of the
sequential execution of its <#3014#>units<#3014#> in textual order. The value
(if any) of a <#3015#>paragraph<#3015#> is the value of its last <#3016#>unit<#3016#>.
Notice that a <#3017#>paragraph<#3017#> may be empty. In that case it has neither
an effect nor a value.