Wikipedia

Coco/R

Also found in: Encyclopedia.
Coco/R
Original author(s)Hanspeter Mössenböck and others
PlatformCross-platform
TypeParser/scanner generator
LicenseGNU GPL
Websitessw.jku.at/Research/Projects/Coco/

Coco/R is a compiler generator that takes an L-attributed Extended Backus–Naur Form (EBNF) grammar of a source language and generates a scanner and a parser for that language.

The scanner works as a deterministic finite automaton. It supports Unicode characters in UTF-8 encoding and can be made case-sensitive or case-insensitive. It can also recognize tokens based on their right-hand-side context. In addition to terminal symbols the scanner can also recognize pragmas, which are tokens that are not part of the syntax but can occur anywhere in the input stream (e.g. compiler directives or end-of-line characters).

The parser uses recursive descent; LL(1) conflicts can be resolved by either a multi-symbol lookahead or by semantic checks. Thus the class of accepted grammars is LL(k) for an arbitrary k. Fuzzy parsing is supported by so-called ANY symbols that match complementary sets of tokens. Semantic actions are written in the same language as the generated scanner and parser. The parser's error handling can be tuned by specifying synchronization points and "weak symbols" in the grammar. Coco/R checks the grammar for completeness, consistency, non-redundancy as well as for LL(1) conflicts.

There are versions of Coco/R for Java, C#, C++, Pascal, Modula-2, Modula-3, Delphi, VB.NET, Python, Ruby and other programming languages. The latest versions from the University of Linz are those for C#, Java and C++. For the Java version, there is an Eclipse plug-in and for C#, a Visual Studio plug-in. There are also sample grammars for Java and C#.

Coco/R was originally developed at the ETHZ and moved with Hanspeter Mössenböck to University of Linz when he got his appointment there. Coco/R is distributed under the terms of a slightly relaxed GNU General Public License.

See also

References

  • Terry, Pat (2005). Compiling with C# and Java. Addison Wesley. (A book about using Coco/R for compiler construction.)
  • Rechenberg, Peter; Mössenböck, Hanspeter (1985). Ein Compiler-Generator für Mikrocomputer - Grundlagen, Anwendungen, Programmierung in Modula-2 (in German) (1 ed.). Munich, Germany: Carl Hanser Verlag. ISBN 3-446-14495-1. (NB. The book describes the construction of Coco in Modula-2.)

External links

This article is copied from an article on Wikipedia® - the free encyclopedia created and edited by its online user community. The text was not checked or edited by anyone on our staff. Although the vast majority of Wikipedia® encyclopedia articles provide accurate and timely information, please do not assume the accuracy of any particular article. This article is distributed under the terms of GNU Free Documentation License.

Copyright © 2003-2025 Farlex, Inc Disclaimer
All content on this website, including dictionary, thesaurus, literature, geography, and other reference data is for informational purposes only. This information should not be considered complete, up to date, and is not intended to be used in place of a visit, consultation, or advice of a legal, medical, or any other professional.