27 March 2000 Release 2.22 Notes for New Users of PCCTS Version 1.33MR22
4
#142.
Experimental
ANTLR
option -mrhoistk on for suppression of predicates with lookahead depth
k
> 1
33
#143.
Use #pred statement to describe the logical relationship of related predicates
34
#144.
Disable predicate hoisting explicitly using the pseudo-action:
rule: <<;>> <<nohoist>> ...
34
#145.
Simplification of predicate expressions when there are multiple references to predicates
34
Debugging Tips for New Users of
PCCTS
#146.
A syntax error with quotation marks on separate lines means a problem with newline
35
#147.
Use the
ANTLR
gd switch to debug via rule trace
#148.
Use the
ANTLR
gs switch to generate code with symbolic names for token tests
#149.
How to track
DLG
results
35
#150.
For complex problems use traceOption and traceGuessOption to control trace output
Switches and Options
#151.
Use
ANTLR
gx switch to suppress regeneration of the
DLG
code and recompilation of
DLG
Lexer.cpp
35
#152.
Can't use an interactive scanner (
ANTLR
gk option) with
ANTLR
infinite lookahead
#153.
To make
DLG
case insensitive use the
DLG
ci switch
35
#154.
Use
ANTLR
option -glms to convert Microsoft file names like "..\foo.g" to "../foo.g" in generated files
#155.
Use
ANTLR
option -treport
number
to locate alternatives using a lot of CPU time to resolve
35
#156.
The
ANTLR
option -info ( p - predicate, t - tnodes, m - monitor, f - follow set, o - orphans)
35
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
36
#158.
How to put file scope information into the second file of a grammar with two .g files
36
Source Code Format
#159.
To place the C right shift operator ">>" inside an action use "\>\>"
36
#160.
One can continue a regular expression in a #token statement across lines (or use flex definitions)
36
#161.
A #token without an action will attempt to swallow an action which immediately follows it - use ";"
36
Miscellaneous
#162.
A grammar may contain multiple start rules. They aren't declared.
#163.
Given
rule[A a,B b] > [X x]
the proto is
X rule(ASTBase* ast,int* sig,A a,B b)
37
#164.
To remake
ANTLR
after changes to the source code use
make -f makefile1
37
#165.
ANTLR
reports "... action buffer overflow ..."
37
#166.
Exception handling uses status codes and
switch
statements to unwind the stack rule by rule
#167.
For tokens with complex internal structure add #token expressions to match frequent errors
37
#168.
See pccts/testcpp/2/test.g and testcpp/3/test.g for examples of how to integrate non-
DLG
lexers with
PCCTS
#169.
Ambiguity, full LL(
k
), and the linear approximation to LL(
k
)
37
#170.
Ambiguity,
#pragma
, and
ANTLR
-rl switch (Contributed by John Lilley jlilley@empathy.com)
39
#171.
What is the difference between "
(...)? <<...>>?
x
" and "
(...)? => <<...>>?
x
" ?
41
#172.
Memory leaks and lost resources
41
#173.
Some ambiguities can be fixed by introduction of new #token numbers
41
#174.
Subclassing
DLG
InputStream
42
Changes From The Original 1.33 Which Are Not Part of Any Other Section
#175.
Use
#first <<...>
to place references to precompiled header files at the beginning of generated files
#176.
Use
DLG
LexerBase::reset() to reset the input stream when parsing the input stream multiple times.
#177.
Error counters are:
ANTLR
Parser::syntaxErrCount and
DLG
LexerBase::lexErrCount
42
#178.
Use "
class MyParser : public MyBaseParser ... {
" to specify your own parser base class
42
#179.
Use
#FirstSetSymbol(
symbol_name
)
to generate symbol for first set of an alternative
42
#180.
Use
-preamble
and
-preamble_first
to insert macro code at the start of each rule or block
42
#181.
Preprocessor option
ZZDEFER_FETCH
to defer token fetch for C++ mode
42
#182.
Exception handling
42
(C Mode) LA/LATEXT and NLA/NLATEXT
#183.
Do not use LA(
i
) or LATEXT(
i
) in the action routines of #token
43
#184.
Care must be taken in using LA(
i
) and LATEXT(
i
) in interactive mode (
ANTLR
switch gk)
43
(C Mode) Execution-Time Routines
#185.
Calls to zzskip() and zzmore() should appear only in #token actions (or in subroutines they call)