1 | cfa-cc: Cforall to C Trans-compiler
|
---|
2 | ======================================
|
---|
3 |
|
---|
4 | This is a PRE-RELEASE version of cfa-cc. It exists solely for the purpose of
|
---|
5 | private experimentation and scholarly research. The authors disclaim all
|
---|
6 | responsibility for the consequences of any malfunction of the software,
|
---|
7 | including the malfunction of any programs compiled using the software.
|
---|
8 |
|
---|
9 |
|
---|
10 | What is Cforall?
|
---|
11 | ----------------
|
---|
12 | Cforall is a language design extending ISO C. The purpose of the project is to
|
---|
13 | engineer modern language features into C in an evolutionary rather than
|
---|
14 | revolutionary way. Java is an example of the revolutionary approach of
|
---|
15 | modernizing C/C++, resulting in a new language rather than an extension of its
|
---|
16 | descendents. C++, Fortran 95 and Cobol 9X are examples of the evolutionary
|
---|
17 | approach where modern language features are added and problems fixed within the
|
---|
18 | framework of an existing language.
|
---|
19 |
|
---|
20 | The goal of this project is to produce a largely backwards compatible version
|
---|
21 | of C containing many modern language features and fixing some of the well known
|
---|
22 | C problems. Without continued development of the language, C will be unable to
|
---|
23 | cope with the needs of modern programming problems and programmers; as a
|
---|
24 | result, it will fade into disuse. Considering the large body of existing C
|
---|
25 | code and programmers, there is a significant impetus to ensure C is transformed
|
---|
26 | into a modern programming language.
|
---|
27 |
|
---|
28 |
|
---|
29 | What is cfa-cc?
|
---|
30 | ---------------
|
---|
31 | cfa-cc is a collection of programs centred around a translator (trans-compiler)
|
---|
32 | that takes Cforall code as input and outputs augmented C code that implements
|
---|
33 | new features. The translator is complemented by a compiler driver in the style
|
---|
34 | of "gcc", which handles preprocessing (including cfa-cc after cpp), compiling,
|
---|
35 | assembling, and linking.
|
---|
36 |
|
---|
37 | cfa-cc is currently written in C++, but eventually be rewritten in Cforall.
|
---|
38 |
|
---|
39 |
|
---|
40 | How to download and build cfa-cc?
|
---|
41 | ----------------------------------------
|
---|
42 | Download cfa-cc using
|
---|
43 |
|
---|
44 | $ git clone https://github.com/cforall/cforall.git
|
---|
45 |
|
---|
46 | Read the ./INSTALL file for build instructions.
|
---|
47 |
|
---|
48 |
|
---|
49 | How to use cfa-cc?
|
---|
50 | -------------------
|
---|
51 | The compiler driver "cfa" accepts all of the arguments for gcc, and is used in
|
---|
52 | the same way. For example:
|
---|
53 |
|
---|
54 | cfa -c test.c
|
---|
55 | cfa test.o
|
---|
56 |
|
---|
57 | Cforall source files may end with '.c' or '.cfa' in order to be compiled by the
|
---|
58 | compiler driver. In addition, the flag "-CFA" causes cfa to invoke the C
|
---|
59 | preprocessor and Cforall translator and write the translator output to standard
|
---|
60 | output.
|
---|
61 |
|
---|
62 |
|
---|
63 | How to use C code with cfa-cc?
|
---|
64 | -----------------------------------
|
---|
65 | cfa-cc should be able to compile and link most ANSI C programs with associated
|
---|
66 | C standard libraries.
|
---|
67 |
|
---|
68 | Like C++, Cforall supports overloading, resulting in duplicate names that are
|
---|
69 | disambiguated using name mangling in the translated C code. To prevent
|
---|
70 | mangling of C names, it is necessary to wrap C declarations in an extern "C"
|
---|
71 | block, as for C++. For example:
|
---|
72 |
|
---|
73 | extern "C" {
|
---|
74 | #include <curses.h>
|
---|
75 | #include <getopt.h>
|
---|
76 | }
|
---|
77 |
|
---|
78 | The extern "C" turns off name mangling for functions and objects declared
|
---|
79 | within the block. All C standard headers are pre-wrapped, so most wrapping is
|
---|
80 | unnecessary.
|
---|
81 |
|
---|
82 |
|
---|
83 | What's wrong with cfa-cc?
|
---|
84 | -------------------------
|
---|
85 |
|
---|
86 | The authors consider cfa-cc to be in a semi-stable state. It is possible for
|
---|
87 | reasonable Cforall programs to fail compilation. A list of bugs and fixes is
|
---|
88 | available here: https://cforall.uwaterloo.ca/trac. We encourage users to
|
---|
89 | report their experiences to cforall@plg.uwaterloo.ca, but we can make no
|
---|
90 | promises regarding support.
|
---|
91 |
|
---|
92 | Also, the Cforall features web-page https://cforall.uwaterloo.ca/features lists
|
---|
93 | small syntactic and semantic differences with standard C.
|
---|
94 |
|
---|
95 |
|
---|
96 | Who is responsible for cfa-cc?
|
---|
97 | ------------------------------
|
---|
98 | Cforall was designed and implemented by Andrew Beach, Richard Bilson, Michael
|
---|
99 | Brooks, Peter A. Buhr, Thierry Delisle Glen Ditchfield, Rodolfo G. Esteves,
|
---|
100 | Aaron Moss, Colby Parsons, Rob Schluntz, Fangren Yu, Mubeen Zulfiqar, and others.
|
---|
101 |
|
---|
102 | Check the Cforall web site https://cforall.uwaterloo.ca for news and updates.
|
---|