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