a2ca17fa85
Migrate from devo/gcc/ch. From-SVN: r22035
253 lines
7.5 KiB
Plaintext
253 lines
7.5 KiB
Plaintext
GNU CHILL: A Complete CHILL Implementation
|
||
|
||
CHILL (the CCITT High Level Language) is a strongly-typed, block
|
||
structured language designed primarily for the implementation of large
|
||
and complex embedded systems. Tens of millions of lines of CHILL code
|
||
exist, and about 15,000 programmers world-wide use CHILL. Many
|
||
central-office telephone switching systems use CHILL for their control
|
||
software.
|
||
|
||
CHILL was designed to
|
||
|
||
- enhance reliability and run time efficiency by means of extensive
|
||
compile time checking;
|
||
- provide sufficient flexibility and power to encompass the required
|
||
range of applications and to exploit a variety of hardware;
|
||
_ provide facilities that encourage piecewise and modular development
|
||
of large systems;
|
||
- cater to real-time implementations by providing built-in concurrency
|
||
and time supervision primitives;
|
||
- permit the generation of highly efficient object code;
|
||
- facilitate ease of use and a short learning curve.
|
||
|
||
CHILL is specified in the "Blue Book":
|
||
CCITT High Level Language (CHILL) Recommendation Z.200
|
||
ISO/IEC 9496, Geneva 1989 ISBN 92-61-03801-8
|
||
|
||
Cygnus Support has completed the first level implementation of the
|
||
GNU CHILL compiler. Our compiler now supports the core features of
|
||
the CHILL language. Our goal is a fully retargetable, complete
|
||
implementation of the Z.200 specification. The next phase of
|
||
implementation will include:
|
||
|
||
. a minimal real-time kernel for demonstration use
|
||
. more rigorous type checking
|
||
. retargetable input/output
|
||
. interprocess communications
|
||
. fully compliant exception handling.
|
||
|
||
The State of the Implementation
|
||
|
||
The GNU CHILL compiler is in early beta state, performing correct
|
||
compilation and execution of correctly coded programs. Like most
|
||
CHILL compilers, the GNU compiler implements a large subset of the
|
||
language (as described below).
|
||
|
||
Since it uses the same compiler back-ends as the GNU C and C++
|
||
compilers, GNU CHILL is almost instantly available on all
|
||
platforms supported by GNU C, including the following:
|
||
|
||
m680xx, i960, i80x86, AMD29K, R3000, R4000, SPARClite,
|
||
Hitachi H8 and SH families, Z8001/2
|
||
|
||
It has been specifically tested under SunOS on SPARCs and under
|
||
SCO Unix on 80386s.
|
||
|
||
All of the GCC optimizations apply to CHILL as well, including
|
||
function inlining, dead code elimination, jump-to-jump elimination,
|
||
cross-jumping (tail-merging), constant propagation, common
|
||
subexpression elimination, loop-invariant code motion, strength
|
||
reduction, loop unrolling, induction variable elimination, flow
|
||
analysis (copy propagation, dead store elimination and elimination
|
||
of unreachable code), dataflow-driven instruction scheduling, and
|
||
many others.
|
||
|
||
I/O statements are parsed. The anticipated timeframe for I/O code
|
||
generation is Q1 1994.
|
||
|
||
What's Next
|
||
|
||
The multi-tasking functions require a small real time kernel.
|
||
A free implementation of such a kernel is not yet available.
|
||
We plan to offer a productized P-threads interface in Q2 1994.
|
||
Other runtime functions involving strings and powersets are
|
||
working.
|
||
|
||
GDB, the GNU Debugger, has been modified to provide simple CHILL
|
||
support. Some CHILL expressions are not yet recognized.
|
||
|
||
For those who aren't familiar with CHILL, here's a small but
|
||
useful example program:
|
||
|
||
--
|
||
-- Convert binary integers to decimal-coded ASCII string
|
||
--
|
||
vary1: MODULE
|
||
|
||
-- include declarations so we can output the test results
|
||
<> USE_SEIZE_FILE 'chprintf.grt' <>
|
||
SEIZE chprintf;
|
||
|
||
-- create a new name for the CHAR array mode
|
||
SYNMODE dec_string = CHAR (6) VARYING;
|
||
|
||
int_to_dec_char: PROC (decimal_num INT IN)
|
||
RETURNS (dec_string);
|
||
|
||
DCL neg_num BOOL := FALSE; -- save sign of parameter
|
||
DCL out_string dec_string;
|
||
|
||
IF decimal_num < 0 THEN -- positive numbers are easier
|
||
decimal_num := -decimal_num;
|
||
neg_num := TRUE;
|
||
FI
|
||
|
||
IF decimal_num = 0 THEN
|
||
out_string := '0'; /* handle zero */
|
||
ELSE
|
||
out_string := '';
|
||
DO WHILE decimal_num /= 0; -- loop until number is zero
|
||
-- concatenate a new digit in front of the output string
|
||
out_string := CHAR (ABS (decimal_num REM D'10) + H'30)
|
||
// out_string;
|
||
decimal_num := decimal_num / D'10;
|
||
OD;
|
||
IF neg_num THEN
|
||
-- prepend a hyphen for numbers < zero
|
||
out_string := '-' // out_string; -- restore sign
|
||
FI;
|
||
FI;
|
||
RESULT out_string; -- remember result
|
||
|
||
decimal_num := 0; -- reset for next call
|
||
neg_num := FALSE;
|
||
out_string := ' ';
|
||
|
||
END int_to_dec_char;
|
||
|
||
/* Try some test cases */
|
||
chprintf (int_to_dec_char (123456), 0);
|
||
chprintf ("^J", 0);
|
||
|
||
chprintf (int_to_dec_char (-654321), 0);
|
||
chprintf ("^J", 0);
|
||
|
||
chprintf (int_to_dec_char (0), 0);
|
||
chprintf ("^J", 0);
|
||
|
||
END vary1;
|
||
|
||
Completeness
|
||
|
||
GNU CHILL currently supports the following features. This outline
|
||
generally follows the structure of the Blue Book specification:
|
||
|
||
CCITT High Level Language (CHILL) Recommendation Z.200
|
||
ISO/IEC 9496, Geneva 1989 ISBN 92-61-03801-8
|
||
|
||
|
||
Modes (types)
|
||
no DYNAMIC modes yet
|
||
discrete modes
|
||
integer, boolean, character, real
|
||
multiple integer/real precisions (an extension)
|
||
set modes, range modes
|
||
powersets
|
||
references
|
||
(no ROW modes)
|
||
procedure modes
|
||
instance modes
|
||
event modes
|
||
buffer modes
|
||
(no input/output modes yet)
|
||
(no timing modes yet)
|
||
composite modes
|
||
strings
|
||
arrays
|
||
structures
|
||
VARYING string/array modes
|
||
(type-checking is not fully rigorous yet)
|
||
forward references
|
||
|
||
Expressions
|
||
literals
|
||
tuples
|
||
slices, ranges
|
||
the standard operators
|
||
|
||
Actions (statements)
|
||
assignments
|
||
if .. then .. else .. fi
|
||
cases
|
||
do action
|
||
do .. with
|
||
exits
|
||
calls
|
||
results/returns
|
||
gotos
|
||
assertions
|
||
cause exception
|
||
start/stop/continue process
|
||
|
||
Input/Output
|
||
(not yet)
|
||
|
||
Exception handling
|
||
fully compiled, but exceptions aren't
|
||
generated in all of the required situations
|
||
|
||
Time Supervision
|
||
(syntax only)
|
||
|
||
Inter-process communications
|
||
delay/delay case actions
|
||
send signal/receive case actions
|
||
send buffer/receive case actions
|
||
|
||
Multi-module programming
|
||
Seize/grant processing
|
||
multiple modules per source file
|
||
|
||
|
||
Bibliography
|
||
|
||
This list is included as an invitation. We'd appreciate hearing
|
||
of CHILL-related documents (with ISBN if possible) which aren't
|
||
described here. We're particularly interested in getting copies
|
||
of other conference Proceedings.
|
||
|
||
CCITT High Level Language (CHILL) Recommendation Z.200
|
||
ISO/IEC 9496, Geneva 1989 ISBN 92-61-03801-8
|
||
(The "blue book". The formal language definition; mostly a
|
||
language-lawyer's document, but more readable than most.)
|
||
|
||
Study Group X - Report R 34
|
||
This is the May 1992 revision of Z.200.
|
||
|
||
An Analytic Description of CHILL, the CCITT high-level
|
||
language, Branquart, Louis & Wodon, Springer-Verlag 1981
|
||
ISBN 3-540-11196-4
|
||
|
||
CHILL User's Manual
|
||
CCITT, Geneva 1986 ISBN 92-61-02601-X
|
||
(Most readable, but doesn't cover the whole language).
|
||
|
||
Introduction to CHILL
|
||
CCITT, Geneva 1983 ISBN 92-61-017771-1
|
||
|
||
CHILL CCITT High Level Language
|
||
Proceedings of the 5th CHILL Conference
|
||
North-Holland, 1991 ISBN 0 444 88904 3
|
||
|
||
Introduction to the CHILL programming Language
|
||
TELEBRAS, Campinas, Brazil 1990
|
||
|
||
CHILL: A Self-Instruction Manual
|
||
Telecommunication Institute - PITTC
|
||
Available from KVATRO A/S, N-7005 Trondheim, Norway
|
||
Phone: +47 7 52 00 90
|
||
(Great discussion of novelty.)
|
||
|
||
Some of these documents are available from Global Engineering
|
||
Documents, in Irvine, CA, USA. +1 714 261 1455.
|