Facebook Instagram Twitter RSS Feed PodBean Back to top on side

Defining C Preprocessor Macro Libraries with Functional Programs

In: Computing and Informatics, vol. 35, no. 4
B. Németh - M. Karácsony - Z. Kelemen - M. Tejfel

Details:

Year, pages: 2016, 819 - 851
Keywords:
C preprocessor, functional programming, Haskell, program transformation, transcompiler
About article:
The preprocessor of the C language provides a standard way to generate code at compile time. However, writing and understanding these macros is difficult. Lack of typing, statelessness and uncommon syntax are the main reasons of this difficulty. Haskell is a high-level purely functional language with expressive type system, algebraic data types and many useful language extensions. These suggest that Haskell code can be written and maintained easier than preprocessor macros. Functional languages have certain similarities to macro languages. By using these similarities this paper describes a transformation that translates lambda expressions into preprocessor macros. Existing compilers for functional languages generate lambda expressions from the source code as an intermediate representation. As a result it is possible to write Haskell code that will be translated into preprocessor macros that manipulate source code. This may result in faster development and maintenance of complex macro metaprograms.
How to cite:
ISO 690:
Németh, B., Karácsony, M., Kelemen, Z., Tejfel, M. 2016. Defining C Preprocessor Macro Libraries with Functional Programs. In Computing and Informatics, vol. 35, no.4, pp. 819-851. 1335-9150.

APA:
Németh, B., Karácsony, M., Kelemen, Z., Tejfel, M. (2016). Defining C Preprocessor Macro Libraries with Functional Programs. Computing and Informatics, 35(4), 819-851. 1335-9150.