This is the next entry in the series on program transformation systems. This article describes C-Breeze, a compiler system for C source code.
C-Breeze is a compiler project for C programs. The purpose of the project is to provide access to the compiler data structures through an API in C++. Two data structures are provided: the AST, via a tree walker class and node editing class; the machine independent control flow graph (MIR). Additional components include a code generator
Several projects have been based on C-Breeze. Leow, Ng, and Wong (2006) used C-Breeze to compile OpenMP C programs and generate code for FPGAs. Jacobs and Lewis (2006) extended C-Breeze to provide “smart macros”, which are source-to-source translations for checking user code after parsing. Using these type-aware patterns, the system can add checks for null pointer dereferences, debugging output statements, etc.
Observations and notes
- C-Breeze is a compiler infrastructure and does provide for some program transformation features, such as an AST visitor API, and AST rewriter. But, there is no pattern matching/rewrite language for ASTs.
- Due to other infrastructures available (LLVM, SUIF), it hasn’t been used since, outside of computer science course work.
- The source and/or executables aren’t available, but the documentation is. For example, all the AST node types are described here. The Walker class is used to visit AST nodes in a
partcular order. The Changer class is used to alter the AST.
References
Leow, Y.Y., Ng, C.Y. and Wong, W.F., 2006, December. Generating hardware from OpenMP programs. In 2006 IEEE International Conference on Field Programmable Technology(pp. 73-80). Ieee. (DOI, pdf)
Jacobs, M. and Lewis, E.C., 2006, September. SMART C: A semantic macro replacement translator for C. In 2006 Sixth IEEE International Workshop on Source Code Analysis and Manipulation (pp. 95-106). IEEE. (DOI, pdf)
Additional Reading
Brown, A., Guyer, S.Z., Jiménez, D.A. and Lin, C., 2004. The C-Breeze compiler infrastructure. Department of Computer Sciences, The University of Texas, Austin, TX,†Technical report. (ps)
Guyer, S.Z. and Lin, C., 2005. Broadway: A compiler for exploiting the domain-specific semantics of software libraries. Proceedings of the IEEE, 93(2), pp.342-357. (DOI, pdf)
Streiff, B., 2008. Bullseye: A System for Targeted Test Generation. (pdf)