Usermanual Coco R
The Compiler Generator Coco/R
User Manual
Hanspeter Mössenböck
Johannes Kepler University Linz
Institute of System Software
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 canbe
resolved by a multi-symbol lookahead or by semantic checks. Thus the class of accepted
grammars is LL(k) for an arbitrary k.
There are versions of Coco/R for C#, Java, C++, Delphi, Modula-2, Oberon and other
languages. This manual describes the versions for C#, Java and C++ from the University
of Linz.
Download from: http://ssw.jku.at/Coco/
Compiler Generator Coco/R,
Copyright ©1990, 2010 Hanspeter Mössenböck, University of Linz
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 theimplied 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
Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As an exception, it is allowed to write an extension of Coco/R thatis 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.
1
Coco/R stands for compiler compiler generating recursive descent parsers.
2
Contents
1. Overview..............................................................................................................................................3
1.1 Sample Production.........................................................................................................................3
1.2 Sample Parsing Method .................................................................................................................4
1.3 Summary ofFeatures.....................................................................................................................4
2. Input Language.....................................................................................................................................5
2.1 Vocabulary.....................................................................................................................................5
2.2Overall Structure............................................................................................................................6
2.3 Scanner Specification ....................................................................................................................7
2.3.1 Character sets.........................................................................................................................7
2.3.2 Tokens....................................................................................................................................8
2.3.3 Pragmas..................................................................................................................................9
2.3.4 Comments............................................................................................................................10
2.3.5 White space..........................................................................................................................10
2.3.6 Case sensitivity ....................................................................................................................11
2.4 Parser Specification...
Regístrate para leer el documento completo.