home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
sa104os2.zip
/
SATHR104.ZIP
/
SATHER
/
DOC
/
MAN
/
CAT1
/
CS.1
next >
Wrap
Text File
|
1994-11-18
|
11KB
|
331 lines
CS(1) User Commands CS(1)
NAME
cs - Sather 1.0 compiler
SYNOPSIS
cs [ files and options ]
DESCRIPTION
cs is the Sather 1.0 compiler. A specification of the
Sather language and more information can be obtained by
anonymous ftp from "icsi.berkeley.edu:/pub/sather" or in the
WWW at "http://http.icsi.berkeley.edu/Sather". Postscript
should also be in the "Doc" directory of the distribution.
There is also a newsgroup "comp.lang.sather".
FILES
File names must be in one of the following forms:
_f_i_l_e.sa - A Sather source file.
_f_i_l_e.c - A C source file.
_f_i_l_e.o - An object file.
_f_i_l_e.a - An archive file.
GENERAL OPTIONS
-main _c_l_a_s_s
Specifies the class whose _m_a_i_n routine will become the
first executed function. If this option is not pro-
vided there must be a class MAIN containing a routine
_m_a_i_n which will be used.
-o _f_i_l_e
Produce the executable _f_i_l_e. If this is not provided
the default file name is `a.out'.
-output_C
Do not delete the directory containing C files after
compilation. The directory is the executable name fol-
lowed by `.code'.
-pretty
Generate C files that are as readable as possible,
doing proper indentation and adding comments when pos-
sible.
-verbose
Give information about what the compiler is doing.
-psather
Accept pSather code. This option is useful for
Sun Microsystems Last change: 1
CS(1) User Commands CS(1)
verifying that Serial Sather code does not use any
pSather keywords that could cause problems if the code
is to be used on pSather systems.
-only_parse
Stop compilation after all Sather files have been
parsed.
-has _f_i_l_e _c_l_a_s_s(_e_s)
Inform the compiler what classes are in a file. Files
for which this is provided will only be parsed if there
is a reference to a listed class. This option is used
to avoid parsing library code which is not reached.
Classes with different numbers of parameters are not
distinguished.
-only_check
Perform typechecking but do not generate C for any
code.
-only_C
Stop the compile after the C code has been generated
and do not invoke the C compiler. Also generates C
files in the current directory as if "-output_C" had
been given.
-only_reachable
Inhibit type checking of unreachable code; by default
all code is checked.
CODE GENERATION OPTIONS
These options may affect compile time, execution time, and
executable size.
Checking options
There are a number of checks that may be enabled. Checks
have the useful property that if a program runs to comple-
tion with checks on, it will run to completion with them
off, given the same input and computational environment.
All checking options are of the form -_c_h_k and may be dis-
abled by using an option of the form -no__c_h_k. All checking
options accept a class list. Giving the class name "all"
(illegal as a class name because it is lower case) is a
shortcut for listing all classes.
-when _c_l_a_s_s(_e_s)
It is not legal for a _c_a_s_e or _t_y_p_e_c_a_s_e statement to not
provide a suitable _w_h_e_n or _e_l_s_e clause for its argu-
ment. If when clause checks are enabled, this results
in a fatal error. When clause checks are usually inex-
pensive.
Sun Microsystems Last change: 2
CS(1) User Commands CS(1)
-void _c_l_a_s_s(_e_s)
It is illegal access an attribute, access an array ele-
ment, or dispatch on the type of _v_o_i_d. Void checks are
usually inexpensive.
-arith _c_l_a_s_s(_e_s)
It is possible for certain routines in _I_N_T to cause
fatal errors. Examples are overflowing or division by
zero. Some arithmetic checks are inexpensive and some
may be quite expensive, depending on the processor and
compiler. Because arithmetic operations account for
the bulk of the processing time of many programs, by
default only those operations which are very inexpen-
sive have checking turned on (such as those that can be
performed without additional code in-line, often divi-
sion by zero.)
-bounds _c_l_a_s_s(_e_s)
It is not legal to access _A_R_E_F elements with indices
below zero or above _a_s_i_z_e -1. Out-of-bounds checks
ensure that attempting such an access results in a
fatal error.
-pre _c_l_a_s_s(_e_s)
-post _c_l_a_s_s(_e_s)
-assert _c_l_a_s_s(_e_s)
-invariant _c_l_a_s_s(_e_s)
_p_r_e, _p_o_s_t, _a_s_s_e_r_t and _i_n_v_a_r_i_a_n_t are Sather language
constructs which allow programmers to provide checks of
their own. These may be expensive, especially invari-
ants, which are checked after every routine call.
-destroy _c_l_a_s_s(_e_s)
The routine _S_Y_S::_d_e_s_t_r_o_y($_O_B) allows programmers to
assert that objects should no longer be accessed by the
program. With optimization on and destroy checking
off, this becomes a memory deallocation and potential
source of dangling pointer errors. With destroy check-
ing on, the compiler tests every object access to make
sure it is not to an object which has been destroyed.
Because of garbage collection, explicit calls to des-
troy are not necessary except in time critical applica-
tions. Because it is dangerous, destroy should only be
used by experts.
-return _c_l_a_s_s(_e_s)
It is a fatal error for the last statement executed by
a routine to be something other than a raise or return.
When return checks are on, a test occurs which enforces
Sun Microsystems Last change: 3
CS(1) User Commands CS(1)
this. Return checks are usually inexpensive.
By default only void, when clause, return, and bounds checks
are performed. It should not be possible to crash a Sather
program with the default checks enabled except by improper
external calls or destroys. It is also possible to turn on
or off all checking:
-check _c_l_a_s_s(_e_s)
Specify that all checks within the classes occur. " -
check all" is recommended to assure the greatest level
of safety.
-no_check _c_l_a_s_s(_e_s)
Generated code will not perform any checks, except
those that will not result in less efficient code. Use
this with caution.
Other generation options
-optimize or -O
Attempt optimizations; this may lengthen the compile
time in an attempt to improve code quality. By default
only very fast optimizations are performed. This
option is turned on by -fast.
-fast
Turn on optimizations and turn off all checking. Same
as "-optimize -no_check all". Use with caution.
-debug or -g
Generate symbolic debugging information.
-deterministic
Causes compilation with deterministic object id's.
Programs compiled with "-deterministic" should always
execute identically, even on different platforms
(unless there are differences in input, word size or
external classes). This is accomplished by an addi-
tional field in each object which is given a unique id
at the time of creation. Without this flag it is pos-
sible that differences in object allocation due to
dark, sinister forces can cause nondeterminism. By
default determinism is off.
-C_flag _f_l_a_g
Specifies an additional flag that will be appended to
the C compiler command line.
FILE OPTIONS
-home _d_i_r_e_c_t_o_r_y
Specifies the directory to use for obtaining compiler
Sun Microsystems Last change: 4
CS(1) User Commands CS(1)
system files. This must be provided.
-com _f_i_l_e
The text of a command file is interpreted as additional
options in the command line at the point where `-com'
was encountered. If the environment variable
SATHER_COMMANDS is defined, its contents are inter-
preted as further commands following the initial file
list in the command line.
Filename expansion is performed as in csh. Relative
file names on the command line or in the
SATHER_COMMANDS variable are relative to the current
directory; those in command files are relative to the
file in which they occur.
Comments in command files start with `--' and continue
to the end of the line.
EXAMPLE
Here at ICSI, users should set their environment variable
SATHER_COMMANDS to "-home /usr/local/lang/sather -com
/usr/local/lang/sather/Library/base.commands". Then a file
"foo.sa" with the FOO class containing main can be compiled
with the command "cs foo.sa -main FOO".
BUGS
See the file "Doc/Bugs" in the Sather distribution. Send
bug reports to "sather-bugs@icsi.berkeley.edu".
Sun Microsystems Last change: 5