Notes on PCCTS by Hugh Sasse


Contents

Purpose of these documents
Other PCCTS resources
Why PCCTS 1.xx and not ANTLR 2.xx?
The Grammar file

Purpose of these documents

These documents are based on information freely available on the net, but are organised differently. They are being created as part of my learning about PCCTS, and they are put on the web so that I can access them easily, and in the hope that they will be useful to other people.

Given that these are being produced as part of my learning process, it may be that the information is inaccurate at the start. I hope I will be able to get things accurate fairly soon, but if you spot something wrong, please let me know.


Other PCCTS resources

PCCTS
See also

Why PCCTS 1.xx and not ANTLR 2.xx?

The principal reason for not using ANTLR2.0 despite its ability to produce Java output as well as C, is that it is implemented in JAVA, and I wanted a C/C++ implementation.

Other reasons include there being no currently maintained version of YACC that will deal with C++ output, although I gather that SORCERER as part of PCCTS will take me further than YACC could on its own.


The Grammar file

PCCTS has one large file as input, which includes the information for the Lexical Analyser as well as the parser itself.

The grammar for the file is described here.

Note: this uses EBNF, such that {...} represents something optional, (...) groups terms together... Also this describes the full input to PCCTS, not just the DGL or ANTLR bit, because they are all thrown together in one file.

grammar      : definitions rules
             ;


definitions  : "#header" NEWLINE headerblock 
               { NEWLINE "#lexclass" LEXCLASSNAME}
               { (NEWLINE "#token" tokendef) *}

             ;


rules        : (rule)+
             ;


rule         : rulename ":" ruledef { ("|" ruledef )+ } ";"
             ;

First Created on 29-APR-1999 Last Modified on 30-APR-1999 by Hugh Sasse <hgs@dmu.ac.uk>