Abstract
The C language is often indispensable for developing practical systems, but it is not so easy to extendthe C language by adding a new feature such as fine-grained multithreading. We can implement languageextension by modifying a C compiler, but sometimes we can do it by translating an extended C programinto C code. In the latter method, we usually convert the source program to an Abstract Syntax Tree(AST), apply analysis or transformation necessary for the extension, and then generate C code.Structures, objects (in object-oriented languages), or variants are traditionally used as the datastructure for an AST. In this research, we propose a new scheme where an AST is represented by anS-expression and such an S-expression is also used as (a part of) a program. For this purpose we havedesigned the SC language, the C language with S-expression-based syntax. This scheme allows rapidprototyping of language extension because (1) adding new constructs to the SC language is easy, (2)S-expressions can easily be read/printed, analyzed, and transformed in the Common Lisp language, whichfeatures dynamic variables useful for translation. Since pattern matching cannot be described directlyin Common Lisp, we also propose denoting transformation rules with patterns using the backquote-macronotation. Such an SC language can also be used as an intermediate language for other high-levelprogramming languages. This paper also shows a practical example where fine-grained multithreadingfeatures are added to the SC language. (author abst.)
Cite
CITATION STYLE
Tasuku, H., X, L., Masahiro, Y., Seiji, U., & Taiichi, Y. (2005). Language Extension by Rule-based Transformation for S-expression-based C Languages. Transactions of Information Processing Society of Japan, 46(SIG1(PRO24)), 40–56.
Register to see more suggestions
Mendeley helps you to discover research relevant for your work.