Declarative Language Denitions and Code Generation as Linearization
Aarne Ranta · 2004
This paper presents a compiler for a fragment of the C programming language, with JVM (Java Virtual Machine) as target language. The compiler is implemented in a purely declarative way: its denition consists of an abstract syntax of program structures and two concrete syntaxes matching the abstract syntax: one for C and one for JVM. From these grammar components, the compiler is derived by using the GF (Grammatical Framework) grammat tool: the front end consists of parsing and semantic checking in accordance to the C grammar, and the back end consists of linearization in accordance to the JVM grammar. The tool provides other functionalities as well, such as decompilation and interactive editing.