27 March 2000 Release 2.22 Notes for New Users of PCCTS Version 1.33MR22
1
Mail corrections, suggestions, or comments to tmoog@polhode.com
Where is
#1.
The current maintenance release of
PCCTS
, these notes, and related examples are available on the net
Primary Site:
URL
:
http://www.polhode.com/pccts.html
anonymous ftp:
ftp://ftp.enteract.com/users/tmoog
Europe:
anonymous ftp:
ftp://ftp.th-darmstadt.de/pub/programming/compiler-compiler/pccts/*
(This is updated weekly on Sunday.)
#2.
Some other items available at http://www.polhode.com:
Link to the complete and unabridged version of T.J. Parr's book,
Language Translation Using PCCTS and C++.
Link to the source code for the examples from this book.
Example grammars for C++,
ANSI
C, and Fortran 77. The Fortran 77 grammar (C mode) by Ferhat Hajdarpasic
includes Sorcerer routines.
Log of all changes made as part of the maintenance releases:
CHANGES_FROM_133*.TXT
.
List of known problems:
KNOWN_PROBLEMS.TXT
.
#3.
Newsgroup is comp.compilers.tools.pccts. Mailing list is pccts_1-33 at onelist.com.
Basics
#4.
Invoke
ANTLR
or
DLG
with no arguments to get a switch summary
#5.
Tokens begin with uppercase characters, rules begin with lowercase characters
#6.
Even in C mode you can use C++ style comments in the non-action portion of
ANTLR
source code
Inside an action you have to obey the comment conventions of your compiler.
#7.
In #token regular expressions spaces and tabs which are not escaped are ignored
This makes it easy to add white space to a regular expression:
#token Symbol "[a-z A-Z] [a-z A-Z 0-9]*"
#8.
Never choose names which coincide with compiler reserved words or library names
You'd be surprised how often someone has done something like one of the following:
#token FILE "file"
#token EOF "@"
const: "[0-9]*" ;
#9.
Write <<predicate>>? not <<predicate
semi-colon
>>? (semantic predicates go in "if" conditions)
#10.
Some constructs which cause warnings about ambiguities and optional paths
rule : a { ( b | c )* } ;
rule : a { b } ;
b : ( c )* ;
rule : a c* ;
a : b { c } ;
rule : a { b | c | } ;
Checklist
#11.
Locate incorrectly spelled #token symbols using
ANTLR
w2 switch or by inspecting
parserClassName
.cpp
If a #token symbol is spelled incorrectly
ANTLR
will assign it a new #token number which, of course, will never be
matched.