Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Python implementation of the famous Coco/R LL(k) compiler generator
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Coco/R ( 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.

There is version of Coco/R for Python language.

This is a fork of CocoPy-1.1.0rc ( of
Ronald Longo, since it unmaintained.

This distribution is a release candidate.

Setup and usage information can be found in section 3 of
documentation/CocoDoc.htm.  CocoDoc.htm contains everything you need to
use Coco for Python.

This file contains a list of the contents of the distribution and a
development roadmap.


This distribution of Coco includes the following:

   Coco root directory

      The application files            - The main application file         - The lexical analizer for attributed grammars          - The parser for attributed grammars       - Generates the main application       - Generates the parser   - Common code generation routines       - Implementation of character classes          - Tracking and reporting errors in the source grammar           - Routines for generating trace files            - Scanner generator and various support classes.

      Other           - Python distribution utilities setup script for Coco.       - CocoPy Version information
      README.txt         - this file.


      license.txt        - The license agreement
      CocoDoc.htm        - The documentation for CocoPy
      howToBootstrap.txt - Instructions on how to bootstrap Coco (outdated)
      DataStructurres.pdf- A description of the workings of Coco
      pimaker.txt        - Documentation of pimaker.


      Various example Attributed Grammars, not all are LL(1).


      The basic Frame files.  These are template files used by the code
      generation routines.


      These are the source files needed to bootstrap CocoPy.

      Coco.atg       - The grammar for the Coco language.
      Coco.frame     - Frame file for Coco's main module.
      Parser.frame   - Frame file for Coco's parser module.
      Scanner.frame  - Frame file for Coco's scanner module.

   /pimaker (Python Interactive Make utility)

      The Python Interactive Make utility written in Coco as a practical
      example of Coco usage.

      pimaker.atg    - The grammar for a file.
      pimaker.frame  - The frame file for pimaker's main module.  - Library of routines needed by pimaker.     - Pimaker's equivalent to a 'makefile' to bootstrap Coco.


      The testbootstrap target in pimaker simply diffs the generated files, and  If there are no differences,
      the test passes.  However, when modifications are made to
      this sort of testing is not sufficient.

      The suite of tests is in this directory are ported for the C#
      implementation of Coco/R.  They test Coco/R features.  To run the
      test suite open a command shell into the testSuite folder and execute
      the following:

         >>> python


   - Version numbering is tentative.

Release#   Goal
--------   ------------------------------------------------------
1.0.10b2.  Coco now bootstraps correctly.

1.1.0rc.   *** Release Candidate -- Coco now successfully runs the test suite
           from the C# implementation.

1.1.1rc.   Coco now correctly parses the examples and reports all the errors
           in the example grammars.

1.1.2rc.   Code generated from examples now sucessfully loads into python
           using 'python'

1.1.3rc    Code generated from examples now successfully parses input
           and generates errors when appropriate.

1.2.0.     *** Final -- No bugs reported or found for some (as yet
           undetermined) period of time (e.g. 3 months).

1.2.x.     Various bug fix releases

1.3.0.     Coco is now updated to equivalence of the latest Java & C#

2.0.0.     *** Enhancements -- Incorporated various enhancements
           - get rid of all the static code
           - Improve indentation of generated code (currently much is
             hardcoded).  Should be more flexible to user's preference.

As I move Coco towards a final release I also want to continuously update
and refine the documentation.
Something went wrong with that request. Please try again.