| [4200b7e] | 1 | cfa-cc: Cforall to C Trans-compiler | 
|---|
| [51b73452] | 2 | ====================================== | 
|---|
|  | 3 |  | 
|---|
| [6244dfb] | 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. | 
|---|
| [51b73452] | 8 |  | 
|---|
| [4200b7e] | 9 |  | 
|---|
| [51b73452] | 10 | What is Cforall? | 
|---|
|  | 11 | ---------------- | 
|---|
| [6244dfb] | 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. | 
|---|
| [51b73452] | 27 |  | 
|---|
| [4200b7e] | 28 |  | 
|---|
| [51b73452] | 29 | What is cfa-cc? | 
|---|
|  | 30 | --------------- | 
|---|
| [4200b7e] | 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 |  | 
|---|
| [44b37de] | 37 | cfa-cc is currently written in C++, but will be eventually rewritten in Cforall. | 
|---|
| [4200b7e] | 38 |  | 
|---|
| [51b73452] | 39 |  | 
|---|
| [4200b7e] | 40 | How to download and build cfa-cc? | 
|---|
| [51b73452] | 41 | ---------------------------------------- | 
|---|
| [4200b7e] | 42 | Download cfa-cc using | 
|---|
| [51b73452] | 43 |  | 
|---|
| [4200b7e] | 44 | $ git clone https://github.com/cforall/cforall.git | 
|---|
| [51b73452] | 45 |  | 
|---|
| [4200b7e] | 46 | Read the ./INSTALL file for build instructions. | 
|---|
|  | 47 |  | 
|---|
|  | 48 |  | 
|---|
|  | 49 | How to use cfa-cc? | 
|---|
| [51b73452] | 50 | ------------------- | 
|---|
| [4200b7e] | 51 | The compiler driver "cfa" accepts all of the arguments for gcc, and is used in | 
|---|
| [6244dfb] | 52 | the same way.  For example: | 
|---|
| [51b73452] | 53 |  | 
|---|
| [4200b7e] | 54 | cfa -c test.c | 
|---|
|  | 55 | cfa test.o | 
|---|
| [51b73452] | 56 |  | 
|---|
| [4200b7e] | 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. | 
|---|
| [51b73452] | 61 |  | 
|---|
|  | 62 |  | 
|---|
| [4200b7e] | 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. | 
|---|
| [51b73452] | 67 |  | 
|---|
| [4200b7e] | 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: | 
|---|
| [51b73452] | 72 |  | 
|---|
| [4200b7e] | 73 | extern "C" { | 
|---|
|  | 74 | #include <curses.h> | 
|---|
|  | 75 | #include <getopt.h> | 
|---|
|  | 76 | } | 
|---|
| [51b73452] | 77 |  | 
|---|
|  | 78 | The extern "C" turns off name mangling for functions and objects declared | 
|---|
| [4200b7e] | 79 | within the block. All C standard headers are pre-wrapped, so most wrapping is | 
|---|
|  | 80 | unnecessary. | 
|---|
|  | 81 |  | 
|---|
| [51b73452] | 82 |  | 
|---|
|  | 83 | What's wrong with cfa-cc? | 
|---|
|  | 84 | ------------------------- | 
|---|
|  | 85 |  | 
|---|
| [4200b7e] | 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. | 
|---|
| [6244dfb] | 91 |  | 
|---|
| [4200b7e] | 92 | Also, the Cforall features web-page https://cforall.uwaterloo.ca/features lists | 
|---|
|  | 93 | small syntactic and semantic differences with standard C. | 
|---|
| [6244dfb] | 94 |  | 
|---|
| [da60c631] | 95 |  | 
|---|
| [51b73452] | 96 | Who is responsible for cfa-cc? | 
|---|
|  | 97 | ------------------------------ | 
|---|
| [4200b7e] | 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. | 
|---|
| [51b73452] | 101 |  | 
|---|
| [4200b7e] | 102 | Check the Cforall web site https://cforall.uwaterloo.ca for news and updates. | 
|---|