OpenC: Extending C with Computational Reflection

Songqing Yue*
Department of Mathematics and Computer Science, University of Central Missouri, Warrensburg, USA.
Periodicity:April - June'2014
DOI : https://doi.org/10.26634/jse.8.4.3046

Abstract

Computational Reflection has shown much promise for improving the quality of software by providing programming language techniques to address issues of modularity, reusability, maintainability, and extensibility. The Meta-Object Protocol (MOP) is a powerful tool to provide the capability of computational reflection by means of object oriented and reflective techniques to organize a meta-level architecture. It provides a set of interfaces for developers to access the underlying implementation of programs in order to automate the source-to-source program translations. In this paper, the author describes how to bring the power of computational reflection to C through a MOP, named OpenC, which offers a framework to build arbitrary source-to-source program transformation libraries for large software systems written in C. The design focus of OpenC is to automate program transformations in a straightforward and transparent way through techniques of code generation, so that client users only need to add a simple annotation to their code to be manipulated, while removing the need to know the details on how the transformations are performed. The paper provides a general motivation for using reflection and explains briefly the design and implementation of the OpenC framework. In addition, this paper will show an example, how OpenC can be used to build a simple profiling library that can be employed to analyse the distribution of execution time among all functions in a project by recording the amount of time spent on executing each function.

Keywords

Computational Reflection, Program Transformation, Meta-Object Protocol.

How to Cite this Article?

Yue ,S.(2014). OpenC: Extending C with Computational Reflection. i-manager’s Journal on Software Engineering, 8(4), 1-8. https://doi.org/10.26634/jse.8.4.3046

References

[1]. Smith, B. C. (1982). Reflection and semantics in a procedural language(Doctoral dissertation, Massachusetts Institute of Technology, Department of Electrical Engineering and Computer Science).
[2]. Feferman, S. (1962). Transfinite recursive progressions of axiomatic theories. The Journal of Symbolic Logic, Vol.27(03), pp.259-316.
[3]. Maes, P. (1987, December). Concepts and experiments in computational reflection. In ACM Sigplan Notices, Vol. 22, No. 12, pp. 147-155.
[4]. Bobrow, D. G., Gabriel, R. ., & White, J. L. (1993). Clos in context-the shape of the design space. Object Oriented Programming: The CLOS Perspective, pp.29- 61.
[5] Demers, F. N., & Malenfant, J. (1995, August). Reflection in logic, functional and object-oriented programming: a short comparative study. In Proceedings of the IJCAI, Vol. 95, pp. 29-38.
[6]. Maes, P. (1988). Computational reflection. The Knowledge Engineering Review, Vol.3(01), pp.1-19.
[7]. Kiczales, G. (1991). The art of the metaobject protocol. MIT press.
[8]. DeMichiel, L. G., & Gabriel, R. P. (1987, January). The common lisp object system: An overview. In ECOOP’87 European Conference on Object-Oriented Programming (pp. 151-170). Springer Berlin Heidelberg.
[9]. Chiba, S. (1995, October). A metaobject protocol for C++. In ACM Sigplan Notices, Vol. 30, No. 10, pp. 285- 299.
[10]. Tatsubori, M., Chiba, S., Killijian, M. O., & Itano, K. (2000). OpenJava: A class-based macro system for Java.
[11]. http://rosecompiler.org/
[12]. http://www.edg.com/index.php?location=c_ frontend
[13]. Kiczales, G., Ashley, J. M., Rodriguez, L., Vahdat, A., & Bobrow, D. G. (1993). Metaobject protocols: Why we want them and what else they can do. Object-Oriented Programming: The CLOS Perspective, pp.101-118.
[14]. Scott, M. L. (2000). Programming language pragmatics. Morgan Kaufmann.
[15]. Myers, G. J., Sandler, C., & Badgett, T. (2011). The art of software testing. John Wiley & Sons.
If you have access to this article please login to view the article or kindly login to purchase the article

Purchase Instant Access

Single Article

North Americas,UK,
Middle East,Europe
India Rest of world
USD EUR INR USD-ROW
Pdf 35 35 200 20
Online 35 35 200 15
Pdf & Online 35 35 400 25

Options for accessing this content:
  • If you would like institutional access to this content, please recommend the title to your librarian.
    Library Recommendation Form
  • If you already have i-manager's user account: Login above and proceed to purchase the article.
  • New Users: Please register, then proceed to purchase the article.