OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / ch / chill.texi
1 @\input texinfo @c -*-texinfo-*-
2 @setfilename chill.info
3 @settitle Guide to GNU Chill
4
5
6 @ifinfo
7 @format
8 START-INFO-DIR-ENTRY
9 * Chill: (chill).               Chill compiler
10 END-INFO-DIR-ENTRY
11 @end format
12 @end ifinfo
13
14 @titlepage
15 @title GNU Chill
16 @author William Cox, Per Bothner, Wilfried Moser
17 @end titlepage
18
19 @ifinfo
20 @node Top
21 @top
22
23 @menu
24 * Options::               Compiler options
25 * Missing::               Unimplemented parts of the Chill language
26 * Enhancements::          GNU-specific enhancements to the Chill language
27 * Conversions::           Value and location conversions
28 * Separate compilation::  Separate compilation
29 * Differences::           Differences between GNUCHILL and Z.200/1988
30 * Directives::            Implemented Compiler Directives
31 * References::            Language definition references
32 @end menu
33
34 @end ifinfo
35
36 @node Options
37 @chapter Compiler options
38
39 Invoking the compiler:
40
41 The @sc{gnu} CHILL compiler supports several new command line options, and
42 brings a new use to another:
43
44 @table @code
45 @item -lang-chill
46 This option instructs gcc that the following file is a CHILL source file,
47 even though its extension is not the default `.ch'.
48
49 @item -flocal-loop-counter
50 The CHILL compiler makes a separate reach, or scope,
51 for each DO FOR loop.  If @code{-flocal-loop-counter} is
52 specified, the loop counter of value enumeration and location
53 enumeration is automatically declared inside that reach.
54 This is the default behavior, required by Z.200.
55
56 @item -fno-local-loop-counter
57 When this option is specified, the above automatic declaration
58 is not performed, and the user must declare all loop counters 
59 explicitly.
60
61 @item -fignore-case
62 When this option is specified, the compiler ignores case. All 
63 identifiers are converted to lower case. This enables the usage
64 of C runtime libraries.
65
66 @item -fno-ignore-case
67 Ignoring the case of identifiers is turned off.
68
69 @item -fruntime-checking
70 The CHILL compiler normally generates code to check 
71 the validity of expressions assigned to variables or
72 expressions passed as parameters to procedures and processes,
73 if those expressions cannot be checked at compile time.
74 This is the default behavior, required by Z.200.
75 This option allows you to re-enable the default behavior
76 after disabling it with the @code{-fno-runtime-checking}
77 option.
78
79 @item -fno-runtime-checking
80 The CHILL compiler normally generates code to check 
81 the validity of expressions assigned to variables, or
82 expressions passed as parameters to procedures and processes.
83 This option allows you to disable that code generation.
84 This might be done to reduce the size of a program's
85 generated code, or to increase its speed of execution.
86 Compile time range-checking is still performed.
87
88 @item -fgrant-only
89 @itemx -fchill-grant-only
90 This option causes the compiler to stop successfully
91 after creating the grant file specified by the source
92 file (see modular programming in CHILL).  No code is
93 generated, and many categories of errors are not reported.
94
95 @item -fold-string
96 Implement the semantics of Chill 1984 with respect to strings:
97 String indexing yields a slice of length one;  CHAR is similar
98 to CHAR(1) (or CHARS(1)); and BOOL is similar to BIT(1) (or BOOLS(1)).
99
100 @item -fno-old-string
101 Don't implement 1984 Chill string semantics.  This is the default.
102
103 @item -I@var{seize_path}
104 This directive adds the specified seize path to the compiler's
105 list of paths to search for seize files.  When processing a 
106 USE_SEIZE_FILE directive, the compiler normally searches for
107 the specified seize file only in the current directory.  When
108 one or more seize paths are specified, the compiler also 
109 searches in those directories, in the order of their
110 specification on the command line, for the seize file.
111
112 @item -c
113 This C-related switch, which normally prevents gcc from 
114 attempting to link, is *not* yet implemented by the @code{chill} command,
115 but you can use the @code{gcc} command with this flag.
116 @end table
117
118 @node Missing
119 @chapter Implemented and missing parts of the Chill language
120
121 The numbers in parentheses are Z.200(1988) section numbers.
122
123 @itemize @bullet
124 @item The FORBID keyword in a GRANT statement is currently ignored.
125
126 @item A CASE action or expression allows only a single expression
127 in a case selector list (5.3.2, 6.4).
128
129 @item ROW modes are not implemented (3.6.3, 3.13.4).
130
131 @item Due to the absence of ROW modes, DYNAMIC has no meaning in
132 connection with access and text modes.
133
134 @item Array and structure layout (PACK, POS, NOPACK, 
135 STEP keywords) is ignored (3.12.6).
136
137 @item Bit-string slices are not implemented.
138
139 @item The support for synchronization modes and concurrent execution
140 is slightly non-standard.
141
142 @item Exception handling is implemented, but exceptions are not
143 generated in all of the required situations.
144
145 @item Dynamic modes are not implemented (though string slices should work).
146
147 @item Reach-bound initializations are not implemented (4.1.2).
148
149 @end itemize
150
151 @node Enhancements
152 @chapter GNU-specific enhancements to the Chill language
153
154 @itemize @bullet
155 @item Grantfiles.  See @xref{Separate compilation}.
156 @item Precisions.  Multiple integer and real precisions are supported,
157 as well as signed and unsigned variants of the integer modes.
158 @item DESCR built-in. The new built-in function 
159 DESCR ( <descriptor argument> ) returns a pointer to 
160 STRUCT( addr PTR, length ULONG ) where <descriptor argument> can be
161 anything the compiler can handle but at least a location of any mode
162 (except synchronizing modes) and any character string or powerset value.
163 (A temporary location within the current stack frame may be allocated
164 if an expression is used.)
165
166 CHILL does not permit the writing of procedures with parameters of
167 any type. Yet some interfaces---in particular those to system 
168 calls---require
169 the handling of a wide range of modes, e.g. any string mode, any structure
170 mode, or any powerset mode. This could be handled by specifying two
171 parameters (PTR, INT for the length) but this is error-prone (no guarantee
172 the same location is used after in ADDR and LENGTH), and it will not be
173 possible for expressions.
174
175 Caveats: This feature permits the programmer to obtain the address of
176 a literal (if the compiler takes this shortcut---see 1st example below).
177 If hardware features protect constant parts of the program, erronous
178 abuse will be detected.
179
180     Examples:
181        OFFER_HANDLER( descr("dbs"), ->dbs);
182
183        SYNMODE m_els = SET( ela, elb, elc );
184        SYNMODE m_elsel = POWERSET m_els;
185        DCL user_buf STRUCT( a mx, b my, c mz);
186        DCL select POWERSET m_elsel;
187
188        select := m_elsel[LOWER(m_els) : UPPER(m_els)];
189
190        GET_RECORD( relation, recno, descr(user_buf), descr(select) );
191
192        PUT_RECORD( relation, recno, descr(user_buf.b), descr(m_elsel[elb]) );
193
194 @item LENGTH built-in on left-hand-side.       The LENGTH built-in may be
195 used on the left-hand-side of an assignment, where its argument is a VARYING
196 character string.
197 @end itemize
198
199 @node Conversions
200 @chapter Value and location conversions
201
202 Value and location conversions are highly dependent on the target machine.
203 They are also very loosely specified in the 1988 standard.
204 (The 1992 standard seems an improvement.)
205
206 The GNU Chill compiler interprets @code{@var{mode}(@var{exp})} as follows:
207
208 @itemize @bullet
209 @item
210 If @var{exp} is a referable location,
211 and the size of (the mode of) @var{exp} is the same as the size of @var{mode},
212 a location conversion is used.
213 It is implemented exactly as:  @code{(@var{refmode}(-> @var{exp}))->},
214 where @var{refmode} is a synmode for @code{REF @var{mode}}.
215
216 The programmer is responsible for making sure that alignment
217 restrictions on machine addresses are not violated.
218
219 If both @var{mode} and the mode of @var{exp} are discrete modes,
220 alignment should not be a problem, and we get the same conversion
221 as a standard value conversion.
222
223 @item
224 If @var{exp} is a constant,
225 and the size of (the mode of) @var{exp} is the same as the size of @var{mode},
226 then a value conversion is performed.  This conversion is done
227 at compile time, and it has not been implemented for all types.
228 Specifically, converting to or from a floating-point type is not implemented.
229
230 @item
231 If both @var{mode} and the mode of @var{exp} are discrete modes,
232 then a value conversion is performed, as described in Z.200.
233
234 @item
235 If both @var{mode} and the mode of @var{exp} are reference modes,
236 then a value conversion is allowed.
237 The same is true is one mode is a reference mode, and the other
238 is an integral mode of the same size.
239
240 @end itemize
241
242 @node Separate compilation
243 @chapter Separate compilation
244
245 The GNU CHILL compiler supports modular programming.  It
246 allows the user to control the visibility of variables
247 and modes, outside of a MODULE, by the use of GRANT
248 and SEIZE directives.  Any location or mode may be made
249 visible to another MODULE by GRANTing it in the MODULE
250 where it is defined, and SEIZEing it in another MODULE
251 which needs to refer to it.
252
253 When variables are GRANTed in one or more modules of a
254 CHILL source file, the compiler outputs a grant file,
255 with the original source file name as the base name,
256 and the extension `.grt'.  All of the variables and modes
257 defined in the source file are written to the grant file,
258 together with any use_seize_file directives, and the
259 GRANT directives.  A grant file is created for every such
260 source file, except if an identical grant file already 
261 exists.  This prevents unnecessary makefile activity.
262
263 The referencing source file must:
264
265 @enumerate
266 @item specify the grant file in a use_seize_file directive, and
267 @item SEIZE each variable or mode definition that it needs.
268 @end enumerate
269
270 An attempt to SEIZE a variable or mode which is not
271 GRANTed in some seize file is an error.
272
273 An attempt to refer to a variable which is defined in
274 some seize file, but not explicitly granted, is an
275 error.
276
277 An attempt to GRANT a variable or mode which is not
278 defined in the current MODULE is an error.
279
280 Note that the GNU CHILL compiler will *not* write out a
281 grant file if:
282
283 @itemize @bullet
284 @item there are no GRANT directives in the source file, or
285 @item the entire grant file already exists, and is
286      identical to the file which the compiler has just built.
287 (This latter ``feature'' may be removed at some point.)
288 @end itemize
289
290 Otherwise, a grant file is an automatic, unsuppressable
291 result of a successful CHILL compilation.
292
293 A future release will also support using remote spec modules
294 in a similar (but more Blue Book-conforming) manner.
295
296 @node Differences
297 @chapter Differences to Z.200/1988
298
299 This chapter lists the differences and extensions between GNUCHILL 
300 and the CCITT recommendation Z.200 in its 1988 version (reffered to
301 as Z.200/1988).
302
303 @itemize @bullet
304
305 @item 2.2 Vocabulary@*
306 The definition of @i{<simple name string>} is changed to:
307
308 @example
309 @i{<simple name string> ::=}
310 @example
311 @i{@{<letter> | _ @} @{ <letter> | <digit | _ @}}
312 @end example
313 @end example
314
315 @item 2.6 Compiler Directives@*
316 Only one directive is allowed between the compiler directive delimiters
317 `<>' and `<>' or the end-of-line, i.e.
318 @example
319 <> USE_SEIZE_FILE "foo.grt" <>
320 <> ALL_STATIC_OFF
321 @end example
322
323 @item 3.3 Modes and Classes@*
324 The syntax of @i{<mode>} is changed to:
325
326 @example
327 @i{<mode> ::=}
328 @example
329   [@b{READ}] @i{<non-composite-mode>}
330 | [@b{READ}] @i{composite-mode>}
331 @end example
332
333 @i{<non-composite-mode> ::=}
334 @example
335   @i{<discrete mode>}
336 | @i{<real modes>}
337 | @i{<powerset modes>}
338 | @i{<reference mode>}
339 | @i{<procedure mode>}
340 | @i{<instance mode>}
341 | @i{<synchronization mode>}
342 | @i{<timing mode>}
343 @end example
344 @end example
345
346 @item 3.4 Discrete Modes@*
347 The list of discrete modes is enhanced by the following modes:
348
349 @example
350 BYTE         8-bit signed integer
351 UBYTE        8-bit unsigned integer
352 UINT         16-bit unsigned integer
353 LONG         32-bit signed integer
354 ULONG        32-bit unsigned integer
355 @end example
356
357 @strong{Please note} that INT is implemented as 16-bit signed integer.
358
359 @item 3.4.6 Range Modes@*
360 The mode BIN(n) is not implemented. Using INT(0 : 2 ** n - 1) instead of
361 BIN(n) makes this mode unneccessary.
362
363 @item 3.X Real Modes@*
364 Note: This is an extension to Z.200/1988, however, it is defined in
365 Z.200/1992.
366
367 @b{syntax:}
368
369 @example
370 @i{<real mode> ::=}
371 @example
372 @i{<floating point mode>}
373 @end example
374 @end example
375
376 @b{semantics:}
377
378 @example
379 A real mode specifies a set of numerical values which approximate a
380 contiguous range of real numbers.
381 @end example
382
383 @item 3.X.1 Floating point modes@*
384
385 @b{syntax:}
386
387 @example
388 @i{<floating point mode> ::=}
389 @example
390 @i{<floating point mode name}
391 @end example
392 @end example
393
394 @b{predefined names:}
395
396 The names @i{REAL} and @i{LONG_REAL} are predefined as @b{floating
397 point mode} names.
398
399 @b{semantics:}
400
401 A floating point mode defines a set of numeric approximations to a 
402 range of real values, together with their minimum relative accuracy, 
403 between implementation defined bounds, over which the usual ordering 
404 and arithmetic operations are defined. This set contains only the 
405 values which can be represented by the implementation.
406
407 @b{examples:}
408
409 @example
410 @i{REAL}
411 @i{LONG_REAL}
412 @end example
413
414 @item 3.6 Reference Modes@*
415 Row modes are not implemeted at all.
416
417 @item 3.7 Procedure Mode@*
418 The syntax for procedure modes is changed to:
419
420 @example
421 @i{<procedure mode> ::=}
422 @example
423   @b{PROC} @i{([<parameter list>]) [ <result spec> ]}
424   @i{[}@b{EXCEPTIONS}@i{(<exception list>)] [}@b{RECURSIVE}@i{]}
425 | @i{<procedure mode name>}
426 @end example
427
428 @i{<parameter list> ::=}
429 @example
430 @i{<parameter spec> @{, <parameter spec> @} *}
431 @end example
432
433 @i{<parameter spec> ::=}
434 @example
435 @i{<mode> [ <parameter attribute> ]}
436 @end example
437
438 @i{<parameter attribute> ::=}
439 @example
440 @b{IN} | @b{OUT} | @b{INOUT} | @b{LOC}
441 @end example
442
443 @i{<result spec> ::=}
444 @example
445 @b{RETURNS} @i{( <mode> [}@b{LOC}@i{])}
446 @end example
447
448 @i{<exception list> ::=}
449 @example
450 @i{<exception name> @{, <exception name> @} *}
451 @end example
452 @end example
453
454
455 @item 3.10 Input-Output Modes@*
456 Due to the absence of row modes, DYNAMIC has no meaning in an access
457 or text mode definition.
458
459
460 @item 3.12.2 String Modes@*
461 As @i{<string modes>} were defined differently in Z.200/1984, the syntax
462 of @i{<string mode>} is changed to:
463
464 @example
465 @i{<string mode> ::=}
466 @example
467   @i{<string type> ( <string length> ) [} @b{VARYING} @i{]}
468 | @i{<parametrized string mode>}
469 | @i{<string mode name>}
470 @end example
471
472 @i{<parameterized string mode> ::=}
473 @example
474   @i{<origin string mode name> ( <string length> )}
475 | @i{<parameterized string mode name>}
476 @end example
477
478 @i{<origin string mode name> ::=}
479 @example
480 @i{<string mode name>}
481 @end example
482
483 @i{string type}
484 @example
485   @b{BOOLS}
486 | @b{BIT}
487 | @b{CHARS}
488 | @b{CHAR}
489 @end example
490
491 @i{<string length> ::=}
492 @example
493 @i{<integer literal expression>}
494 @end example
495 @end example
496
497 @b{VARYING} is not implemented for @i{<string type>} @b{BIT}
498 and @b{BOOL}.
499
500 @item 3.11.1 Duration Modes@*
501 The predefined mode @i{DURATION} is implemented as a NEWMODE ULONG and
502 holds the duration value in miliseconds. This gives a maximum duration
503 of
504
505 @example
506 MILLISECS (UPPER (ULONG)),
507 SECS (4294967),
508 MINUTES (71582),
509 HOURS (1193), and
510 DAYS (49).
511 @end example
512
513 @item 3.11.2 Absolute Time Modes@*
514 The predefined mode @i{TIME} is implemented as a NEWMODE ULONG and
515 holds the absolute time in seconds since Jan. 1st, 1970. This is
516 equivalent to the mode `time_t' defined on different systems.
517
518 @item 3.12.4 Structure Modes@*
519 Variant fields are allowed, but the CASE-construct may define only one
520 tag field (one dimensional CASE). OF course, several variant fields may
521 be specified in one STRUCT mode. The tag field will (both at compile-
522 and runtime) not be interpreted in any way, however, it must be
523 interpreted by a debugger. As a consequence, there are no parameterized 
524 STRUCT modes.
525
526 @item 3.12.5 Layout description for array and structure modes@*
527 STEP and POS is not implemeted at all, therefore the syntax of
528 @i{<element layout} and @i{field layout} is changed to:
529
530 @example
531 @i{<element layout> ::=}
532 @example
533 @b{PACK} | @b{NOPACK}
534 @end example
535
536 @i{<field layout> ::=}
537 @example
538 @b{PACK} | @b{NOPACK}
539 @end example
540 @end example
541
542 @item 3.13.4 Dynamic parameterised structure modes@*
543 Dynamic parameterised structure modes are not implemented.
544
545 @item 4.1.2 Location declaration@*
546 The keyword STATIC is allowed, but has no effect at module level, because
547 all locations declared there are assumed to be `static' by default. Each
548 granted location will become `public'. A `static' declaration inside a
549 block, procedure, etc. places the variable in the data section instead of
550 the stack section.
551
552 @item 4.1.4 Based decleration@*
553 The based declaration was taken from Z.200/1984 and has the following
554 syntax:
555
556 @b{syntax:}
557
558 @example
559 @i{<based declaration> ::=}
560 @example
561 @i{<defining occerrence list> <mode>} @b{BASED}
562 @i{( <free reference location name> )}
563 @end example
564 @end example
565
566 @b{semantics:}
567
568 A based declaration with @i{<free reference location name>} specifies
569 as many access names as are defining occerrences in the @i{defining
570 occurrence list}. Names declared in a base declaration serve as an
571 alternative way accessing a location by dereferencing a reference 
572 value. This reference value is contained in the location specified by 
573 the @i{free reference location name}. This dereferencing operation is 
574 made each time and only when an access is made via a declared @b{based} 
575 name.
576
577 @b{static properties:}
578
579 A defining occurrence in a @i{based declaration} with @i{free reference
580 location name} defines a @b{based} name. The mode attached to a
581 @b{based} name is the @i{mode} specified in the @i{based declaration}. A
582 @b{based} name is @b{referable}.
583
584 @item 4.2.2 Access names@*
585 The syntax of access names is changed to:
586
587 @example
588 @i{<access name> ::=}
589 @example
590   @i{<location name>}
591 | @i{<loc-identity name>}
592 | @i{<based name>}
593 | @i{<location enumeration name>}
594 | @i{<location do-with name>}
595 @end example
596 @end example
597
598 The semantics, static properties and dynamic conditions remain
599 unchanged except that they are enhanced by @i{base name}.
600
601 @item 5.2.4.1 Literals General@*
602 The syntax of @i{<literal>} is change to:
603
604 @example
605 @i{<literal> ::=}
606 @example
607   @i{<integer literal>}
608 | @i{<boolean literal>}
609 | @i{<charater literal>}
610 | @i{<set literal>}
611 | @i{<emptiness literal>}
612 | @i{<character string literal>}
613 | @i{<bit string literal>}
614 | @i{<floating point literal>}
615 @end example
616 @end example
617
618 Note: The @i{<floating point literal>} is an extension to Z.200/1988 and
619 will be described later on.
620
621 @item 5.2.4.2 Integer literals@*
622 The @i{<decimal integer literal>} is changed to:
623
624 @example
625 @i{<decimal integer literal> ::=}
626 @example
627   @i{@{ D | d @} ' @{ <digit> | _ @} +}
628 | @i{<digit> @{ <digit> | _ @} *}
629 @end example
630 @end example
631
632 @item 5.2.4.4 Character literals@*
633 A character literal, e.g. 'M', may serve as a charater string literal of
634 length 1.
635
636 @item 5.2.4.7 Character string literals@*
637 The syntax of a character string literal is:
638
639 @example
640 @i{<character string literal> ::=}
641 @example
642   @i{'@{ <non-reserved character> | <single quote> |}
643   @i{<control sequence> @} * '}
644 | @i{'@{ <non-reserved character> | <double quote> |}
645   @i{<control sequence> @} * '}
646 @end example
647
648 @i{<single quote> ::=}
649 @example
650 @i{''}
651 @end example
652
653 @i{<double quote> ::=}
654 @example
655 @i{""}
656 @end example
657 @end example
658
659 A character string litaral of length 1, enclosed in apostrophes
660 (e.g. 'M') may also serve as a charater literal.
661
662 @item 5.2.4.9 Floating point literal@*
663 Note: This is an extension to Z.200/1988 ans was taken from Z.200/1992.
664
665 @b{syntax:}
666
667 @example
668 @i{<floating point literal> ::=}
669 @example
670   @i{<unsigned floating point literal>}
671 | @i{<signed floating point literal>}
672 @end example
673
674 @i{<unsigned floating point literal> ::=}
675 @example
676   @i{<digit sequence> . [ <digit sequence> ] [ <exponent> ]}
677 | @i{[ <digit sequence> ] . <digit sequence> [ <exponent> ]}
678 @end example
679
680 @i{<signed floating point literal> ::=}
681 @example
682 @i{- <unsigned floating point literal>}
683 @end example
684
685 @i{<digit sequence> ::=}
686 @example
687 @i{<digit> @{ <digit> | _ @} *}
688 @end example
689
690 @i{<exponent> ::=}
691 @example
692   @i{[ E | D | e | d ] <digit sequence>}
693 | @i{[ E | D | e | d ] - <digit sequence>}
694 @end example
695 @end example
696
697 @item 5.2.14 Start Expression@*
698 The START expression is not implemented.
699
700 @item 5.3 Values and Expressions@*
701 The undefined value, denoted by `*', is not implemented.
702
703 @item 5.3.8 Operand-5@*
704 The @i{<string repetition operator>} is defined as:
705
706 @example
707 @i{<string repetition operator> ::=}
708 @example
709 @i{(<integer expression>)}
710 @end example
711 @end example
712
713 @item 6.4 Case Action@*
714 There may be only one case selector specified. The optional range list
715 must not be specified.
716
717 @item 6.5 Do Action@*
718 A Do-Action without control part is not implemented. Grouping of
719 statements can be achieved via BEGIN and END. A location enumeration is not
720 allowed for BIT strings, only for (varying) CHAR strings and ARRAYs.
721
722 The expression list in a DO WITH must consist of locations only.
723
724 @item 6.13 Start Action@*
725 The syntax of the START action is changed to:
726
727 @example
728 @i{<start action> ::=}
729 @example
730 @b{START} @i{<process name> (<copy number> [, <actual parameter list>])}
731 @i{[} @b{SET} @i{<instance location> ]}
732 @end example
733
734 @i{<copy number> ::=}
735 @example
736 @i{<integer expression>}
737 @end example
738 @end example
739
740 @item 6.16 Delay Action@*
741 The optional PRIORITY specification need not be a constant.
742
743 @item 6.17 Delay Case Action@*
744 The optional SET branch and the, also optional, PRIORITY branch must be
745 separated by `;'.
746
747 @item 6.18 Send Action@*
748 The send action must define a destination instance (via the TO branch),
749 since undirected signals are not supported. The optional PRIORITY
750 specification need not be a constant. Additional to the data
751 transported by the signal, there will be a user defined argument.
752
753 The syntax of the @i{<send signal action>} is therefore:
754
755 @example
756 @i{<send signal action> ::=}
757 @example
758 @b{SEND} @i{<signal name> [ ( <value> @{, <value> @} * ) ]}
759 @i{[} @b{WITH} @i{<expression> ]}
760 @b{TO} @i{<instance primitive value> [ <priority> ]}
761 @end example
762 @end example
763
764 The default priority can be specified by the compiler directive
765 SEND_SIGNAL_DEFAULT_PRIORITY. If this also is omitted, the default
766 priority is 0.
767
768 @item 6.20.3 CHILL value built-in calls@*
769 The CHILL value buit-in calls are enhanced by some calls, and other calls
770 will have different arguments as described in Z.200/1988. Any call not
771 mentioned here is the same as described in Z.200/1988.
772
773 @b{syntax:}
774
775 @example
776 @i{CHILL value built-in routine call> ::=}
777 @example
778   @i{ADDR (<location>)}
779 | @i{PRED (<pred succ argument>)}
780 | @i{SUCC (<pred succ argument>)}
781 | @i{ABS (<numeric expression>)}
782 | @i{LENGTH (<length argument>)}
783 | @i{SIN (<floating point expression>)}
784 | @i{COS (<floating point expression>)}
785 | @i{TAN (<floating point expression>)}
786 | @i{ARCSIN (<floating point expression>)}
787 | @i{ARCCOS (<floating point expression>)}
788 | @i{ARCTAN (<floating point expression>)}
789 | @i{EXP (<floating point expression>)}
790 | @i{LN (<floating point expression>)}
791 | @i{LOG (<floating point expression>)}
792 | @i{SQRT (<floating point expression>)}
793 | @i{QUEUE_LENGTH (<buffer location> | <event location>)}
794 | @i{GEN_INST (<integer expression> | <process name> ,}
795                @i{<integer expression>)}
796 | @i{COPY_NUMBER (<instance expression>)}
797 | @i{GEN_PTYE (<process name>)}
798 | @i{PROC_TYPE (<instance expression>)}
799 | @i{GEN_CODE (<process name> | <signal name>)}
800 | @i{DESCR (<location>)}
801 @end example
802
803 @i{<pred succ argument> ::=}
804 @example
805   @i{<discrete expression>}
806 | @i{<bound reference expression>}
807 @end example
808
809 @i{<numeric expression> ::=}
810 @example
811   @i{<integer expression>}
812 | @i{floating point expression>}
813 @end example
814
815 @i{<length argument> ::=}
816 @example
817   @i{<string location>}
818 | @i{<string expression>}
819 | @i{<string mode name>}
820 | @i{<event location>}
821 | @i{<event mode name>}
822 | @i{<buffer location>}
823 | @i{<buffer mode name>}
824 | @i{<text location>}
825 | @i{<text mode name>}
826 @end example
827 @end example
828
829 @b{semantics:}
830
831 @i{ADDR} is derived syntax for -> @i{<location>}.
832
833 @i{PRED} and @i{SUCC} delivers respectively, in case of a @i{discrete
834 expression}, the next lower or higher discrete value of their argument,
835 in case of @i{bound reference expression} these built-in calls deliver a
836 pointer to the previous or next element.
837
838 @i{ABS} is defined on numeric values, i.e. integer values and floating
839 point values, delivering the corresponding absolute value.
840
841 @i{LENGTH} is defined on
842
843 @itemize @bullet
844
845 @item string and text locations and string expressions, delivering the
846 length of them;
847
848 @item event locations, delivering the @b{event length} of the mode of the
849 location;
850
851 @item buffer locations, delivering the @b{buffer length} of the mode of
852 the location;
853
854 @item string mode names, delivering the @b{string length} of the mode;
855
856 @item text mode names, delivering the @b{text length} of the mode;
857
858 @item buffer mode names, delivering the @b{buffer length} of the mode;
859
860 @item event mode names, delivering the @b{event length} of the mode;
861
862 @item Additionally, @i{LENGTH} also may be used on the left hand
863 side of an assignment to set a new length of a @i{varying character
864 string location}. However, to avoid undefined elements in the varying
865 string, the new length may only be less or equal to the current length.
866 Otherwise a @b{RANGEFAIL} exception will be generated.
867 @end itemize
868
869 @i{SIN} delivers the sine of its argument (interpreted in radians).
870
871 @i{COS} delivers the cosine of its argument (interpreted in radians).
872
873 @i{TAN} delivers the tangent of its argument (interpreted in radians).
874
875 @i{ARCSIN} delivers the sin -1 function of its argument.
876
877 @i{ARCCOS} delivers the cos -1 function of its argument.
878
879 @i{ARCTAN} delivers the tan -1 function of its argument.
880
881 @i{EXP} delivers the exponential function, where x is the argument.
882
883 @i{LN} delivers the natural logarithm of its argument.
884
885 @i{LOG} delivers the base 10 logarithm of its argument.
886
887 @i{SQRT} delivers the sqare root of its argument.
888
889 @i{QUEUE_LENGTH} delivers either the number of sending delayed processes
890 plus the number of messages in a buffer queue (if the argument is a
891 @i{buffer location}), or the number of delayed processes (if the
892 argument specifies an @i{event location}) as @i{integer expression}.
893
894 @i{GEN_INST} delivers an @i{instance expression} constructed from the
895 arguments. Both arguments must have the @i{&INT}-derived class.
896
897 @i{COPY_NUMBER} delivers as @i{&INT}-derived class the copy number of an
898 @i{instance location}.
899
900 @i{GEN_PTYPE} delivers as @i{&INT}-derived class the associated number
901 of the @i{process name}.
902
903 @i{PROC_TYPE} delivers as @i{&INT}-derived class the process type of an
904 @i{instance expression}.
905
906 @i{GEN_CODE} delivers as @i{&INT}-derived class the associated number of
907 the @i{process name} or @i{signal name}.
908
909 @i{DESCR} delivers a @i{free reference expression} pointing to a
910 structure with the following layout describing the @i{location} argument.
911
912 @example
913 SYNMODE __tmp_descr = STRUCT (p PTR, l ULONG);
914 @end example
915
916
917 @item 7.4.2 Associating an outside world object@*
918 The syntax of the associate built-in routine call is defined as:
919
920 @example
921 @i{<associate built-in routine call> ::=}
922 @example
923 @i{ASSOCIATE ( <association location>, <string expression>,} [@i{, <string expression>} ] @i{)}
924 @end example
925 @end example
926
927 The ASSOCIATE call has two parameters besides the association location:
928 a pathname and an optional mode string.
929
930 The value of the first string expression must be a pathname according to
931 the rules of the underlying operating system. (Note that a relative pathname 
932 implies a name relative to the working directory of the process.)
933
934 The mode string may contain the value "VARIABLE", which requests
935 an external representation of records consisting of an UINT record
936 length followed by as many bytes of data as indicated by the length field.
937 Such a file with variable records is not indexable.
938
939 A file with variable records can be written using any record mode. If the 
940 record mode is CHARS(n) VARYING, the record length is equal to the actual 
941 length of the value written.  (Different record may have differing lengths.)
942 With all other record modes, all records written using the same access mode
943 will have the same length, but will still be prefixed with the length field.
944 (Note that by re-connecting with different access modes, the external
945 representation may ultimately contain records with differing lengths.)
946
947 A file with variable records can only be read by using a record mode of
948 CHARS(n) VARYING.
949
950
951 @item 7.4.2 Accessing association attributes@*
952 The value of the READABLE and WRITEABLE attributes is determined using 
953 the file status call provided by the operating system.  The result will
954 depend on the device being accessed, or on the file mode.
955
956 The INDEXABLE attribute has the value false for files with variable records,
957 and for files associated with devices not supporting random positioning
958 (character devices, FIFO special files, etc.).
959
960 The variable attribute is true for files associated with the mode sting
961 "VARIABLE", and false otherwise.
962
963
964 @item 7.4.5 Modifying association attributes@*
965 The syntax of the MODIFY built-in routine call is defined as:
966
967 @example
968 @i{<modify built-in call> ::=}
969 @example
970 @i{MODIFY ( <association location>, <string expression> )}
971 @end example
972 @end example
973
974 At present, MODIFY accepts a character string containing a pathname
975 in addition to the association location, which will cause a renaming 
976 of the associated file.
977
978
979 @item 7.4.9 Data transfer operations@*
980 READRECORD will fail (causing READFAIL) if the number of bytes from the
981 current position in the file to the end of the file is greater than zero
982 but less than the size of the record mode, and no data will be transferred.
983 (If the number of bytes is zero, no error occurs and OUTOFFILE will
984 return TRUE.)
985
986 The number of bytes transferred by READRECORD and WRITERECORD is equal to
987 the size of the record mode of the access location. Note that the
988 internal representation of this mode may vary depending on the
989 record mode being packed or not.
990
991
992 @item 7.5 Text Input Output@*
993 Sequential text files will be represented so as to be compatible
994 with the standard representation of texts on the underlying operating
995 system, where control characters are used to delimit text records on files
996 as well as to control the movement of a cursor or printing head on a device.
997
998 For indexed text files, records of a uniform length (i.e. the size of the
999 text record, including the length field) are written.  All i/o codes cause 
1000 an i/o transfer without any carriage control  characters being added to the
1001 record, which will be expanded with spaces.
1002
1003 An indexed text file is therefore not compatible with the standard
1004 text representation of the underlying operating system. 
1005
1006
1007
1008 @item 7.5.3 Text transfer operations@*
1009 The syntax of @i{<text argument>} is changed to:
1010
1011 @example
1012 @i{<text argument> ::=}
1013 @example
1014   @i{<text location>}
1015 | @i{<predefined text location>}
1016 | @i{<varying string location>}
1017 @end example
1018
1019 @i{<predefined text location> ::=}
1020 @example
1021   STDIN
1022 | STDOUT
1023 | STDERR
1024 @end example
1025 @end example
1026
1027 NOTE: The identifiers STDIN, STDOUT, and STDERR are predefined.
1028 Association and connection with files or devices is done according to
1029 operating system rules.
1030
1031 The effect of using READTEXT or WRITETEXT with a character string location
1032 as a text argument (i.e. the first parameter) where the same location also
1033 appears in the i/o list is undefined.
1034
1035 The current implementation of formatting assumes run-to-completion semantics
1036 of CHILL tasks within an image.
1037
1038
1039
1040 @item 7.5.5 Conversion@*
1041 Due to the implementation of @i{<floating point modes>} the syntax
1042 is changed to:
1043
1044 @example
1045 @i{<conversion clause> ::=}
1046 @example
1047 @i{<conversion code> @{ <conversion qualifier @} *}
1048 @i{[ <clause width> ]}
1049 @end example
1050
1051 @i{<conversion code> ::=}
1052 @example
1053 @i{B} | @i{O} | @i{H} | @i{C} | @i{F}
1054 @end example
1055
1056 @i{<conversion qualifier> ::=}
1057 @example
1058 @i{L} | @i{E} | @i{P<character>}
1059 @end example
1060
1061 @i{<clause width> ::=}
1062 @example
1063   @i{@{ <digit> @} +} | @i{V}
1064 | @i{<real clause width>}
1065 @end example
1066
1067 @i{<real clause width> ::=}
1068 @example
1069 @i{@{ @{ <digit> + | V @} : @{ @{ <digit> @} + | V @}}
1070 @end example
1071 @end example
1072
1073 Note: The @i{<real clause width>} is only valid for @i{<conversion
1074 code>} `C' or `F'.
1075
1076
1077 @item 7.5.7 I/O control@*
1078 To achieve compatibility of text files written with CHILL i/o with
1079 the standard representation of text on the underlying operating system
1080 the interpretation of the i/o control clause of the format 
1081 deviates from Z.200. The following table shows the i/o codes together
1082 with the control characters written before and after the text record, 
1083 to achieve the indicated function:
1084 @table @samp
1085 @item /
1086 Write next record (record, line feed)
1087
1088 @item +
1089 Write record on next page (form feed, record, line feed)
1090
1091 @item -
1092 Write record on current line (record, carriage return)
1093
1094 @item ?
1095 Write record as a prompt (carriage return, record)
1096
1097 @item !
1098 Emit record (record).
1099
1100 @item =
1101 Force new page for the next line: The control character written before
1102 the next record will be form feed, irrespective of the i/o control used for
1103 transferring the record.
1104 @end table
1105
1106 When reading a text file containing control characters other than line feed,
1107 these characters have to be reckoned with by the format used to read the
1108 text records.
1109
1110
1111
1112
1113 @item 11.2.2 Regionality@*
1114 Regionality is not implemented at all, so there is no difference in the
1115 generated code when REGION is substituted by MODULE in a GNUCHILL
1116 compilation unit.
1117
1118 @item 11.5 Signal definition statement@*
1119 The @i{<signal definition statement>} may only occur at module level.
1120
1121 @item 12.3 Case Selection@*
1122 The syntax of @i{<case label specification>} is changed to:
1123
1124 @example
1125 @i{<case label specification> ::=}
1126 @example
1127 @i{( <case label> @{, <case label> @} * )}
1128 @end example
1129
1130 @i{<case label> ::=}
1131 @example
1132   @i{<discrete literal expression>}
1133 | @i{<literal range>}
1134 | @i{<discrete mode name>}
1135 | @b{ELSE}
1136 @end example
1137 @end example
1138
1139 @end itemize
1140
1141 @node Directives
1142 @chapter Compiler Directives
1143
1144 @itemize @bullet
1145
1146 @item ALL_STATIC_ON, ALL_STATIC_OFF@*
1147 These directives control where procedure local variables are
1148 allocated. ALL_STATIC_ON turns allocation of procedure local variables
1149 in the data space ON, regardless of the keyword STATIC being used or not.
1150 ALL_STATIC_OFF places procedure local variables in the stack space.
1151 The default is ALL_STATIC_OFF.
1152
1153 @item RANGE_ON, RANGE_OFF@*
1154 Turns generation of rangecheck code ON and OFF.
1155
1156 @item USE_SEIZE_FILE <character string literal>@*
1157 Specify the filename (as a character string literal) where 
1158 subsequent SEIZE statements are related to. This directive 
1159 and the subsequent SEIZEs are written
1160 to a possibly generated grant file for this module.
1161
1162 @example
1163 <> USE_SEIZE_FILE "foo.grt" <>
1164 SEIZE bar;
1165 @end example
1166
1167 @item USE_SEIZE_FILE_RESTRICTED "filename"@*
1168 Same as USE_SEIZE_FILE. The difference is that this directive
1169 and subsequent SEIZEs are *not* written to a possibly generated
1170 grant file. 
1171
1172 @item PROCESS_TYPE = <integer expression>@*
1173 Set start value for all PROCESS delclarations. This value automatically
1174 gets incremented after each PROCESS declaration and may be changed with
1175 a new PROCESS_TYPE compiler directive.
1176
1177 @item SIGNAL_CODE = <integer expression>@*
1178 Set start value for all SIGNAL definitions. This value automatically
1179 gets incremented after each SIGNAL definition and may be changed with a
1180 new SIGNAL_CODE compiler directive.
1181
1182 @item SEND_SIGNAL_DEFAULT_PRIORITY = <integer expression>@*
1183 Set default priority for send signal action.
1184
1185 @item SEND_BUFFER_DEFAULT_PRIORITY = <integer expression>@*
1186 Set default priority for send buffer action.
1187
1188 Note: Every <integer expression> in the above mentioned compiler
1189 directives may also be specified by a SYNONYM of an integer type.
1190
1191 @example
1192 SYN first_signal_code = 10;
1193 <> SIGNAL_CODE = first_signal_code <>
1194 SIGNAL s1;
1195 @end example
1196
1197 @end itemize
1198
1199 @node References
1200 @chapter Language Definition References
1201
1202 @itemize @bullet
1203 @item   CCITT High Level Language (CHILL) Recommendation Z.200
1204         ISO/IEC 9496, Geneva 1989                ISBN 92-61-03801-8
1205
1206 @item   An Analytic Description of CHILL, the CCITT high-level
1207         language, Branquart, Louis & Wodon, Springer-Verlag 1981
1208                                                  ISBN 3-540-11196-4
1209
1210 @item   CHILL User's Manual
1211         CCITT, Geneva 1986                       ISBN 92-61-02601-X
1212
1213 @item   Introduction to CHILL
1214         CCITT, Geneva 1983                       ISBN 92-61-017771-1
1215
1216 @item   CHILL CCITT High Level Language
1217         Proceedings of the 5th CHILL Conference
1218         North-Holland, 1991                      ISBN 0 444 88904 3
1219
1220 @item   Introduction to the CHILL programming Language
1221         TELEBRAS, Campinas, Brazil 1990
1222
1223 @end itemize
1224
1225 Z.200 is mostly a language-lawyer's document, but more readable
1226 than most.  The User's Guide is more readable by far, but doesn't
1227 cover the whole language.  Our copies of these documents came through
1228 Global Engineering Documents, in Irvine, CA, USA. (714)261-1455.
1229
1230 @contents
1231 @bye