C
ATS
(
TM
) P
ROGRAMMING
L
ANGUAGE
O
VERVIEW
As revised 2006.08.23
Bionic Buffalo Tech Note #84
Security:
Unrestricted
the generated C code was amply commented by the Cats precompiler, so it could be maintained as C
code if necessary.
Although new types are defined, the implementation is left to the precompiler, and is meant to be
opaque to the Cats programmer. For example, it should not be assumed that
string
is implemented as
char *
. In fact,
string
is implemented as a certain structure, but the precompiler may change that
implementation in some future revision. Operators and functions are provided to access features that are
opaque but might be necessary to use in an application.
The primary goal was to augment the C language, while, if possible, allowing the same precompiler to
be used to augment C++. The C++ work lags far behind the C work.
3. Additions to the Language
3.1. New Keywords and Syntax
The following keywords are added to C and to C++ by the Cats programming language:
any
bag
bit
count
foreach
implement
interface
length_of
list
map
object
opaque
plex
regex
sequence
set
sparse
string
thread
type_of
typecode
vacancy_of
value_of
wstring
xchar
xstring
The following sections describe how these new keywords are used.
3.2. New Types and Their Use
string
and
wstring
These are strings of
char
and
wchar_t
. It should not be assumed that they
are implemented as
char *
(or
wchar_t *
), or that they are
NUL
terminated. Variables of these
types can be concatenated using the
+
operator. In a mixed expression,
char *
will be promoted to
string
,
wchar_t *
will be promoted to
wstring
, and
string
will be promoted to
wstring
as
necessary. For example:
char * ptr_to_char ;
wstring widestring ;
Copyright 2006 Bionic Buffalo. All rights reserved.
File tn0084; Modified 20060830 08:00:17
http://www.tatanka.com/doc/technote/index.html
Email:
query@tatanka.com
Page 3 of 12