TL;DR: It is shown that it is possible to generate compilers that are as efficient as hand-coded and carefully optimized production-quality compilers and to generate an Oberon compiler that is even faster than the standard Oberon compilation used at ETH.
Abstract: Formal compiler descriptions serve two purposes: (1) they can be used as a reference document which specifies the syntax and the semantics of a language, and (2) they provide a convenient notation from which efficient compilers can be generated. Compiler generating systems put emphasis on either the one or the other of these aspects. The system described in this report mainly concentrates on the second goal. We show that it is possible to generate compilers that are as efficient as hand-coded and carefully optimized production-quality compilers. Our system generates recursive descent parsers with a simple error-handling mechanism and scanners with a special buffering scheme. Almost as important as efficiency is the simplicity and adequacy of the system. Programmers are not willing to use a tool if it does not come in handy in their work, if it uses a cryptic notation or a multitude of options and special cases. The tool should make their work easier without limiting their flexibility. We used our system to generate an Oberon compiler that is even faster than the standard Oberon compiler used at ETH.
TL;DR: Coco/R 1 is a compiler generator, which takes an attributed grammar of a source language and generates a scanner and a parser for this language and the class of accepted grammars is LL(k) for an arbitrary k.
Abstract: Coco/R 1 is a compiler generator, which takes an attributed grammar of a source language and generates a scanner and a parser for this language. The scanner works as a deterministic finite automaton. The parser uses recursive descent. LL(1) conflicts can be resolved by a multi-symbol lookahead or by semantic checks. Thus the class of accepted grammars is LL(k) for an arbitrary k. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the As an exception, it is allowed to write an extension of Coco/R that is used as a plugin in non-free software. If not otherwise stated, any source code generated by Coco/R (other than Coco/R itself) does not fall under the GNU General Public License.
TL;DR: A compiler front end for C# is implemented that can be used as a framework for implementing a variety of tools, two of which are described in more detail: a white-box testing tool that measures path coverage, and a performance hint tool that evaluates source code according to user-defined rules about performance enhancements or coding style.
Abstract: Recursive descent parsing has the advantage of more convenient semantic processing than in the case of bottom-up parsing. However, it is limited to LL(1) grammars, which has often prevented its use for popular programming languages, such as Java or C#. The authors extended their compiler generator Coco/R, which generates recursive descent parsers, so that the user can specify rules for LL(1) conflict resolution. The simple technique works by evaluating user-defined Boolean expressions to allow the parser to make its parsing decisions where a one-symbol lookahead does not suffice. Thus multi-symbol lookahead or even semantic information can now guide the parsing process as well. Using their extended compiler generator, the authors implemented a compiler front end for C# that can be used as a framework for implementing a variety of tools, two of which are described in more detail: a white-box testing tool that measures path coverage, and a performance hint tool that evaluates source code according to user-defined rules about performance enhancements or coding style.
TL;DR: This work proposes a solution for analyzing programs with multiple language contexts as they occur, for example, in C# 3.0 and shows how to handle additional tokens on top of the infrastructure provided by Coco/R.
Abstract: We propose a solution for analyzing programs with multiple language contexts as they occur, for example, in C# 3.0. C# 3.0 has two contexts: the normal C# context and the language integrated query (Linq) context, which are basically the same, but Linq has some additional keywords that are treated as identifiers in the C# context. We demonstrate our solution by using the compiler generator Coco/R, which provides no support for enabling or disabling tokens in a grammar, as tokens are a global property of a programming language. We show how to handle additional tokens on top of the infrastructure provided by Coco/R.