source: README @ d0e8cfe4

Last change on this file since d0e8cfe4 was 51b7345, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago

initial commit

  • Property mode set to 100644
File size: 5.1 KB
1cfa-cc: The Cforall->C Compiler System
4This is a PRE-RELEASE version of cfa-cc.  It exists solely for the
5purpose of private experimentation and scholarly research.  The authors
6disclaim all responsibility for the consequences of any malfunction of
7the software, including the malfunction of any programs compiled using
8the software.
10What is Cforall?
12Cforall is a language design extending ISO C. The purpose of the
13project is to engineer modern language features into C in an
14evolutionary rather than revolutionary way. Java is an example of the
15revolutionary approach of modernizing C/C++, resulting in a new
16language rather than an extension of its descendents. C++, Fortran 95
17and Cobol 9X are examples of the evolutionary approach where modern
18language features are added and problems fixed within the framework of
19an existing language.
21The goal of this project is to produce a largely backwards compatible
22version of C containing many modern language features and fixing some
23of the well known C problems. Without continued development of the
24language, C will be unable to cope with the needs of modern programming
25problems and programmers; as a result, it will fade into disuse.
26Considering the large body of existing C code and programmers, there is
27a significant impetus to ensure C is transformed into a modern
28programming language.
30What is cfa-cc?
32cfa-cc is a collection of programs centred around a translator that
33takes Cforall code as input and outputs corresponding C code.  This
34is complemented by a compiler driver in the style of "gcc", which
35handles preprocessing, compiling, assembling, and linking and invokes
36the translator at appropriate moments.
38What is required in order to use cfa-cc?
40Building cfa-cc requires GNU Make and gcc/g++ 3.  cfa-cc is written in
43The compiler driver uses an installed version of gcc to handle all
44aspects of the compilation process except for the Cforall->C translation.
45Currently, only gcc 3.2 is supported.
47How is cfa-cc used?
49The compiler driver "cfa" accepts all of the arguments of gcc, and is
50used in the same way.  For example:
52        cfa -c test.c
53        cfa test.o
55Cforall source files must end with '.c' in order to be compiled by the
56compiler driver.  In addition, the flag "-CFA" causes cfa to invoke the
57preprocessor and translator and send the translator output to standard
60In cases where the compiler driver is not useful (i.e., where gcc 3.2
61is not available), it is still possible to invoke the translator
62directly.  The translator is installed by default as
63/usr/local/lib/cfa-cpp.  A typical invocation is:
65        /usr/local/lib/cfa-cpp -cp infile outfile
67If outfile is omitted, output goes to standard output; if infile is
68also omitted, input comes from standard input.  Options to the
69translator other than "-cp" will not produce valid C code and are only
70useful for debugging the translator.
72How can C code be used with cfa-cc?
74cfa-cc should be able to compile most ANSI C programs.  It is also
75possible to link against C libraries in most cases.  Since Cforall
76supports overloading, however, names used in Cforall code are
77mangled in the output C code.  This will cause linker failures when
78the names refer to functions and objects in code compiled with
79a standard C compiler.  For this reason, it is necessary to enclose
80the declarations of these functions and objects in extern "C" {}
81blocks.  For example:
83        extern "C" {
84        #include <stdio.h>
85        #include <stdlib.h>
86        }
88The extern "C" turns off name mangling for functions and objects declared
89within the block.  As a result, it is not possible to overload their
92It is our intention to have a transparent solution to this problem
93in place for our first official release.
95What's wrong with cfa-cc?
97The authors consider this software to be in an unstable state.  It is
98quite likely that there are many reasonable programs that will fail
99to compile.  We encourage users to report their experiences to, but we make no promises regarding support.
102We have fixed most of the problems that we are aware of.  There are
103some exceptions:
105        - initializers are poorly implemented; in particular,
106        file-scope initializers may result in the generation of invalid
107        C code
109        - the ISO C99 designated initialization syntax '[n] = m' or
110        '.n = m' is not supported; use a colon in place of the equal sign
112        - some legitimate programs will produce warnings from the C
113        compiler; these are harmless (in particular, the creation of
114        libcfa.a in the build process should cause four warnings from
115        gcc)
117        - abstract types introduced using the keyword 'type' are not
118        implemented (although 'type' can be used to introduce type
119        parameters)
121        - the implicit coercion of structure types to the type of their
122        first member is not implemented
124Who is responsible for cfa-cc?
126cfa-cc was written by Peter Buhr, Richard Bilson, and Rodolfo Esteves.
127Questions and comments can be sent to
129The Cforall project maintains a web page:
Note: See TracBrowser for help on using the repository browser.