📄 chill.texi
字号:
@\input texinfo @c -*-texinfo-*-@setfilename chill.info@settitle Guide to GNU Chill@ifinfo@formatSTART-INFO-DIR-ENTRY* Chill:: Chill compilerEND-INFO-DIR-ENTRY@end format@end ifinfo@titlepage@title GNU Chill@author William Cox, Per Bothner, Wilfried Moser@end titlepage@ifinfo@node Top@top@menu* Options:: Compiler options* Missing:: Unimplemented parts of the Chill language* Enhancements:: GNU-specific enhancements to the Chill language* Conversions:: Value and location conversions* Separate compilation:: Separate compilation* Differences:: Differences between GNUCHILL and Z.200/1988* Directives:: Implemented Compiler Directives* References:: Language definition references@end menu@end ifinfo@node Options@chapter Compiler optionsInvoking the compiler:The @sc{gnu} CHILL compiler supports several new command line options, andbrings a new use to another:@table @code@item -lang-chillThis option instructs gcc that the following file is a CHILL source file,even though its extension is not the default `.ch'.@item -flocal-loop-counterThe CHILL compiler makes a separate reach, or scope,for each DO FOR loop. If @code{-flocal-loop-counter} isspecified, the loop counter of value enumeration and locationenumeration is automatically declared inside that reach.This is the default behavior, required by Z.200.@item -fno-local-loop-counterWhen this option is specified, the above automatic declarationis not performed, and the user must declare all loop counters explicitly.@item -fignore-caseWhen this option is specified, the compiler ignores case. All identifiers are converted to lower case. This enables the usageof C runtime libraries.@item -fno-ignore-caseIgnoring the case of identifiers is turned off.@item -fruntime-checkingThe CHILL compiler normally generates code to check the validity of expressions assigned to variables orexpressions passed as parameters to procedures and processes,if those expressions cannot be checked at compile time.This is the default behavior, required by Z.200.This option allows you to re-enable the default behaviorafter disabling it with the @code{-fno-runtime-checking}option.@item -fno-runtime-checkingThe CHILL compiler normally generates code to check the validity of expressions assigned to variables, orexpressions passed as parameters to procedures and processes.This option allows you to disable that code generation.This might be done to reduce the size of a program'sgenerated code, or to increase its speed of execution.Compile time range-checking is still performed.@item -fgrant-only@itemx -fchill-grant-onlyThis option causes the compiler to stop successfullyafter creating the grant file specified by the sourcefile (see modular programming in CHILL). No code isgenerated, and many categories of errors are not reported.@item -fold-stringImplement the semantics of Chill 1984 with respect to strings:String indexing yields a slice of length one; CHAR is similarto CHAR(1) (or CHARS(1)); and BOOL is similar to BIT(1) (or BOOLS(1)).@item -fno-old-stringDon't implement 1984 Chill string semantics. This is the default.@item -I@var{seize_path}This directive adds the specified seize path to the compiler'slist of paths to search for seize files. When processing a USE_SEIZE_FILE directive, the compiler normally searches forthe specified seize file only in the current directory. Whenone or more seize paths are specified, the compiler also searches in those directories, in the order of theirspecification on the command line, for the seize file.@item -cThis C-related switch, which normally prevents gcc from attempting to link, is *not* yet implemented by the @code{chill} command,but you can use the @code{gcc} command with this flag.@end table@node Missing@chapter Implemented and missing parts of the Chill languageThe numbers in parentheses are Z.200(1988) section numbers.@itemize @bullet@item The FORBID keyword in a GRANT statement is currently ignored.@item A CASE action or expression allows only a single expressionin a case selector list (5.3.2, 6.4).@item ROW modes are not implemented (3.6.3, 3.13.4).@item Due to the absence of ROW modes, DYNAMIC has no meaning inconnection with access and text modes.@item Array and structure layout (PACK, POS, NOPACK, STEP keywords) is ignored (3.12.6).@item Bit-string slices are not implemented.@item The support for synchronization modes and concurrent executionis slightly non-standard.@item Exception handling is implemented, but exceptions are notgenerated in all of the required situations.@item Dynamic modes are not implemented (though string slices should work).@item Reach-bound initializations are not implemented (4.1.2).@end itemize@node Enhancements@chapter GNU-specific enhancements to the Chill language@itemize @bullet@item Grantfiles. See @xref{Separate compilation}.@item Precisions. Multiple integer and real precisions are supported,as well as signed and unsigned variants of the integer modes.@item DESCR built-in. The new built-in function DESCR ( <descriptor argument> ) returns a pointer to STRUCT( addr PTR, length ULONG ) where <descriptor argument> can beanything the compiler can handle but at least a location of any mode(except synchronizing modes) and any character string or powerset value.(A temporary location within the current stack frame may be allocatedif an expression is used.)CHILL does not permit the writing of procedures with parameters ofany type. Yet some interfaces---in particular those to system calls---requirethe handling of a wide range of modes, e.g. any string mode, any structuremode, or any powerset mode. This could be handled by specifying twoparameters (PTR, INT for the length) but this is error-prone (no guaranteethe same location is used after in ADDR and LENGTH), and it will not bepossible for expressions.Caveats: This feature permits the programmer to obtain the address ofa literal (if the compiler takes this shortcut---see 1st example below).If hardware features protect constant parts of the program, erronousabuse will be detected. Examples: OFFER_HANDLER( descr("dbs"), ->dbs); SYNMODE m_els = SET( ela, elb, elc ); SYNMODE m_elsel = POWERSET m_els; DCL user_buf STRUCT( a mx, b my, c mz); DCL select POWERSET m_elsel; select := m_elsel[LOWER(m_els) : UPPER(m_els)]; GET_RECORD( relation, recno, descr(user_buf), descr(select) ); PUT_RECORD( relation, recno, descr(user_buf.b), descr(m_elsel[elb]) );@item LENGTH built-in on left-hand-side. The LENGTH built-in may beused on the left-hand-side of an assignment, where its argument is a VARYINGcharacter string.@end itemize@node Conversions@chapter Value and location conversionsValue and location conversions are highly dependent on the target machine.They are also very loosely specified in the 1988 standard.(The 1992 standard seems an improvement.)The GNU Chill compiler interprets @code{@var{mode}(@var{exp})} as follows:@itemize @bullet@itemIf @var{exp} is a referable location,and the size of (the mode of) @var{exp} is the same as the size of @var{mode},a location conversion is used.It is implemented exactly as: @code{(@var{refmode}(-> @var{exp}))->},where @var{refmode} is a synmode for @code{REF @var{mode}}.The programmer is responsible for making sure that alignmentrestrictions on machine addresses are not violated.If both @var{mode} and the mode of @var{exp} are discrete modes,alignment should not be a problem, and we get the same conversionas a standard value conversion.@itemIf @var{exp} is a constant,and the size of (the mode of) @var{exp} is the same as the size of @var{mode},then a value conversion is performed. This conversion is doneat compile time, and it has not been implemented for all types.Specifically, converting to or from a floating-point type is not implemented.@itemIf both @var{mode} and the mode of @var{exp} are discrete modes,then a value conversion is performed, as described in Z.200.@itemIf both @var{mode} and the mode of @var{exp} are reference modes,then a value conversion is allowed.The same is true is one mode is a reference mode, and the otheris an integral mode of the same size.@end itemize@node Separate compilation@chapter Separate compilationThe GNU CHILL compiler supports modular programming. Itallows the user to control the visibility of variablesand modes, outside of a MODULE, by the use of GRANTand SEIZE directives. Any location or mode may be madevisible to another MODULE by GRANTing it in the MODULEwhere it is defined, and SEIZEing it in another MODULEwhich needs to refer to it.When variables are GRANTed in one or more modules of aCHILL source file, the compiler outputs a grant file,with the original source file name as the base name,and the extension `.grt'. All of the variables and modesdefined in the source file are written to the grant file,together with any use_seize_file directives, and theGRANT directives. A grant file is created for every suchsource file, except if an identical grant file already exists. This prevents unnecessary makefile activity.The referencing source file must:@enumerate@item specify the grant file in a use_seize_file directive, and@item SEIZE each variable or mode definition that it needs.@end enumerateAn attempt to SEIZE a variable or mode which is notGRANTed in some seize file is an error.An attempt to refer to a variable which is defined insome seize file, but not explicitly granted, is anerror.An attempt to GRANT a variable or mode which is notdefined in the current MODULE is an error.Note that the GNU CHILL compiler will *not* write out agrant file if:@itemize @bullet@item there are no GRANT directives in the source file, or@item the entire grant file already exists, and is identical to the file which the compiler has just built.(This latter ``feature'' may be removed at some point.)@end itemizeOtherwise, a grant file is an automatic, unsuppressableresult of a successful CHILL compilation.A future release will also support using remote spec modulesin a similar (but more Blue Book-conforming) manner.@node Differences@chapter Differences to Z.200/1988This chapter lists the differences and extensions between GNUCHILL and the CCITT recommendation Z.200 in its 1988 version (reffered toas Z.200/1988).@itemize @bullet@item 2.2 Vocabulary@*The definition of @i{<simple name string>} is changed to:@example@i{<simple name string> ::=}@example@i{@{<letter> | _ @} @{ <letter> | <digit | _ @}}@end example@end example@item 2.6 Compiler Directives@*Only one directive is allowed between the compiler directive delimiters`<>' and `<>' or the end-of-line, i.e.@example<> USE_SEIZE_FILE "foo.grt" <><> ALL_STATIC_OFF@end example@item 3.3 Modes and Classes@*The syntax of @i{<mode>} is changed to:@example@i{<mode> ::=}@example [@b{READ}] @i{<non-composite-mode>}| [@b{READ}] @i{composite-mode>}@end example@i{<non-composite-mode> ::=}@example @i{<discrete mode>}| @i{<real modes>}| @i{<powerset modes>}| @i{<reference mode>}| @i{<procedure mode>}| @i{<instance mode>}| @i{<synchronization mode>}| @i{<timing mode>}@end example@end example@item 3.4 Discrete Modes@*The list of discrete modes is enhanced by the following modes:@exampleBYTE 8-bit signed integerUBYTE 8-bit unsigned integerUINT 16-bit unsigned integerLONG 32-bit signed integerULONG 32-bit unsigned integer@end example@strong{Please note} that INT is implemented as 16-bit signed integer.@item 3.4.6 Range Modes@*The mode BIN(n) is not implemented. Using INT(0 : 2 ** n - 1) instead ofBIN(n) makes this mode unneccessary.@item 3.X Real Modes@*Note: This is an extension to Z.200/1988, however, it is defined inZ.200/1992.@b{syntax:}@example@i{<real mode> ::=}@example@i{<floating point mode>}@end example@end example@b{semantics:}@exampleA real mode specifies a set of numerical values which approximate acontiguous range of real numbers.@end example@item 3.X.1 Floating point modes@*@b{syntax:}@example@i{<floating point mode> ::=}@example@i{<floating point mode name}@end example@end example@b{predefined names:}The names @i{REAL} and @i{LONG_REAL} are predefined as @b{floatingpoint mode} names.@b{semantics:}A floating point mode defines a set of numeric approximations to a range of real values, together with their minimum relative accuracy, between implementation defined bounds, over which the usual ordering and arithmetic operations are defined. This set contains only the values which can be represented by the implementation.@b{examples:}@example@i{REAL}@i{LONG_REAL}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -