27 March 2000 Release 2.22 Notes for New Users of PCCTS Version 1.33MR22
2
#45. There is no easy way in
DLG
to distinguish integer "1" from floating point "1." when "1.and.2" is valid
7
#46. For lex operators "^" and "$" (anchor pattern to start/end of line) use flex - don't bother with dlg
­
Line and Column Information
#47. If you want column information for error messages (or other reasons) use C++ mode
­
#48. If you want accurate line information even with many characters of lookahead use C++ mode
­
#49. Call trackColumns() to request that
DLG
maintain column information
­
#50. To report column information in syntax error messages override
ANTLR
Parser::syn() - See Example #5
­
#51. Call newline() and then set_endcol(0) in the #token action when a newline is encountered
­
#52. Adjusting column position for tab characters
7
#53. Computing column numbers when using more() with strings that include tab characters and newlines
8
Ambiguity Aid (options -aa, -aam, -aad
#54. Example with nested if statement
8
#55. Example with cast expression
10
#56. Example with ambiguity due to limitations of linear approximation
11
#57. Summary of command line switches related to ambiguity aid
13
C++ Mode
#58. The destructors of base classes should be virtual in almost all cases
13
#59. Why must the AST root be declared as ASTBase rather than AST ?
13
#60. C++ mode makes multiple parsers easy
14
#61. Use
DLG
LexerBase routines to save/restore
DLG
state when multiple parsers share a token buffer
14
#62. In C++ mode ASTs and
ANTLR
Tokens do not use stack discipline as they do in C mode
14
#63. Summary of Token class inheritance in file AToken.h
14
#64. Diagram showing relationship of major classes
14
#65. Required AST constructors: AST(), AST(
ANTLR
TokenPtr), and AST(X x,Y y) for #[X x,Y y]
­
#66. Tokens are supplied as demanded by the parser. They are "pulled" rather than "pushed"
15
#67. The lexer can access parser information using member function
getParser()
15
#68. Additional notes for users converting from C to C++ mode
15
#69. Use the macro
mytoken(
expr
)
to convert an
ANTLR
TokenPtr to an
ANTLR
Token *
­
#70. When using reference counted tokens be careful about saving a pointer generated by
myToken()
15
#71.
LA(
i
)
is a cache of
LT
(
i
)
values used by the parser - it is valid only for
i
k
­
#72. To disable reference counting of
ANTLR
Tokens use
parserName
.noGarbageCollectTokens()
­
#73. For string input use
DLG
Stri
ngInput(const DLGChar *string)
for a
DLG
InputStream
­
#74. Use
#lexmember <<...>>
to insert code into the
DLG
Lexer class
­
#75. Use
#lexprefix <<...>>
to insert
#include
statements into the
DLG
Lexer file
­
#76. How to change the default error reporting actions of
DLG
and
ANTLR
15
ASTs
#77. To enable AST construction (automatic or explicit) use the
ANTLR
­gt switch
­
#78. Use
ANTLR
option -newAST to make AST creation a member function of the parser
16
#79. Use symbolic tags (rather than numbers) to refer to tokens and ASTs in rules
16
#80. Constructor AST(
ANTLR
TokenPtr) is automatically called for terminals when
ANTLR
­gt switch is used
16
#81. If you use ASTs you have to pass a root AST to the parser
16
#82. Use ast­>destroy() to recursively descend the AST tree and free all sub-trees
­
#83. Don't confuse
#[...]
with
#(...)
16
#84. The make-a-root operator for ASTs ("^") can be applied only to terminals (#token, #tokclass, #tokdef)
17
#85. An already constructed AST tree cannot be the root of a new tree
17
#86. Don't assign to #0 unless automatic construction of ASTs is disabled using the "!" operator on a rule
17
#87. The statement in Item #86 is stronger than necessary
17
#88. A rule that constructs an AST returns an AST even when its caller uses the "!" operator
­
#89. (C++ mode) Without
ANTLR
RefCountToken, a token which isn't used in an AST will result in lost memory 17
#90. When passing
#(...)
or
#[...]
to a subroutine it must be cast from "ASTBase *" to "AST *"
17
#91. Some examples of
#(...)
notation using the
PCCTS
list notation
18
#92. A rule which derives epsilon can short circuit its caller's explicitly constructed AST
18
#93. How to use automatic AST tree construction when a token code depends on the alternative chosen
18