27 March 2000 Release 2.22 Notes for New Users of PCCTS Version 1.33MR22
36
Summary:
-info p
Extra predicate information in generated file.
-info t
Information about tnode usage appears at the end of each rule in the generated file and on stderr.
A tnode is used only when analyzing
k
>1 grammars.
Compare with -treport
number
.
-info m
Monitor progress:
Prints name of each rule as it is started.
Flushes output at start of each rule.
-info f
First/follow set information sent to stdout.
-info o
(letter o) Orphan rules (rules not referenced by any other rule).
-info 0
(digit zero) No-operation
Multiple Source Files
#157.
To see how to place main() in a .cpp file rather than a grammar file (".g") see pccts./testcpp/8/main.cpp
#include "tokens.h"
#include "
myParserClass
.h"
#include "DLGLexer.h"
#158.
How to put file scope information into the second file of a grammar with two .g files
If one did place a file scope action in the second file,
ANTLR
would interpret it as the fail action of the last rule
appearing in the first grammar file.
To place file scope information in the second file #include the generated file in yet another file which has the file
scope declarations.
Source Code Format
#159.
To place the C right shift operator ">>" inside an action use "\>\>"
If you forget to do this you'll get the error message:
warning: Missing <<; found dangling >>
No special action is required for the shift left operator.
#160.
One can continue a regular expression in a #token statement across lines (or use flex definitions)
One can continue an antlr #token definition across a line boundary, by using a backslash, but if your regular
expressions are that long, it might be wiser to use flex, which allows the definition of elements which can be
combined to create complex regular expressions.
#161.
A #token without an action will attempt to swallow an action which immediately follows it - use ";"
This is a minor problem when the #token is created for use with attributes or ASTs nodes and has no regular
expression:
#token CastExpr
#token SubscriptExpr
#token ArgumentList
<<
... Code related to parsing
>>
You'll receive the message:
warning: action cannot be attached to a token name
(...token name...); ignored
To solve this problem one is now allowed to end a #token definition with a ";":
#token ArgumentList ;