Abstract
Partial evaluation is ordinarily intended to be used to increase program efficiency. This paper shows how partial evaluation can be used in place of a preprocessor phase and of source-code templates (e.g. C++ templates or Ada generics). In this way it can be used to support portability features provided by a preprocessor, and the reusability provided by code templates, but with higher maintainability due to the simpler syntax required. The important mechanisms needed are: annotating variables and functions with an evaluation time, treating declarations as translation-time “executable” statements, treating user-defined types as translation-time variables, giving programmers control over the scope of symbols, and providing translation-time name binding. The effects of these changes on the size and complexity of a compiler are estimated. A translator for a language called “Safer_C” which supports these techniques has been implemented. Important existing C software is analyzed to evaluate the applicability of these techniques in replacing the preprocessor.
Chapter PDF
Similar content being viewed by others
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
Baier, R., Glück, R., Zöchling, R.: Partial evaluation of numerical programs in FORTRAN. ACM SIGPLAN Workshop on Partial Evaluation and SemanticsBased Program Manipulation PEPM'94, Orlando, Florida, June 25, 1994. Technical Report 94/9, Dept. of Comp. Sci., Univ. of Melbourne. (1994) 119–132
Consel, C., Danvy, O.: Tutorial notes on partial evaluation. 20-th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages POPL'93, Charleston, SC. (1993) 493–501
Cormack, G. V.: Extensions to static scoping. ACM SIGPLAN Notices 18, 6 (1983) 187–191
IBM: OS and DOS PL/I Language Reference Manual. Reference No. GC26-3977-1, File No. S370-29, IBM Corp., San Jose, CA (1984)
Jones, N. D., Gomard, C. K., Sestoft, Peter: Partial evaluation and automatic program generation. Prentice Hall Int'l., Hemel Hempstead, UK (1993)
Koenig, A.: C Traps and Pitfalls. Addison-Wesley, Reading, MA (1989)
Meyer, U.: Techniques for partial evaluation of imperative languages. Symposium on Partial Evaluation and Semantics-Based Program Manipulation PEPM'91. Yale Univ., New Haven, CT, June 17–19, 1991. ACM SIGPLAN Notices 26, 9 (Sept. 1991) 94–105
Nirkhe, V., Pugh, W.: A partial evaluator for the Maruti hard real-time system. Twelfth Real-Time Systems Symposium. IEEE Computer Society Press, Los Alamitos, CA, USA (1991) 64–73
Salomon, D. J.: Four dimensions of programming-language independence. SIGPLAN Notices 27, 3 (March 1992) 35–53
Salomon, D. J.: Safer_C: syntactically improving the C language for error resistance. Tech. Rep. 95/07, Dept. of Comp. Sci., Univ. of Manitoba (1995)
Stroustrup, B.: The C++ Programming Language, 2-nd Ed. Addison Wesley, Reading, MA. (1991)
Weise, D., Crew, R.: Programmable syntax macros. ACM SIGPLAN Conference on Programming Language Design and Implementation PLDI'93. Albuquerque, NM, June 23–25, 1993. ACM SIGPLAN Notices 28, 6 (June 1993) 156–165
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1996 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Salomon, D.J. (1996). Using partial evaluation in support of portability, reusability, and maintainability. In: Gyimóthy, T. (eds) Compiler Construction. CC 1996. Lecture Notes in Computer Science, vol 1060. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-61053-7_63
Download citation
DOI: https://doi.org/10.1007/3-540-61053-7_63
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-61053-3
Online ISBN: 978-3-540-49939-8
eBook Packages: Springer Book Archive