1changes31(3) ANTLR3C changes31(3)
2
3
4
6 changes31 - Changes in 3.1 from 3.0 The following changes have taken
7 place from 3.0 to 3.1.
8
9 Some of them may require minor changes to your grammar files or the
10 programs that invoke your grammar. Please take the time to read through
11 this list as it may save you time later.
12
14 In previous releases the return value from both the generated
15 constructors and built in constructor functions would return a value of
16 -1 or -2 if a problem occurred. However, the only problem that can
17 really occur is lack of memory, hence to avoid the remote change that
18 some memory allocation scheme would return an address of -1 for a
19 pointer, the return address is now NULL if there was no memory
20 available. The old macros for this mechanism have been removed which
21 will force you to read this information. You now need only check the
22 return address for NULL, or you could not bother doing that and join
23 with 95% of the world's C code.
24
26 The 3.1 runtime now supports tree rewrites from tree parsers. See the
27 main ANTLR documentation for more details. This beta version contains
28 knownissues regarding the release of mmeory allocated to tree nodes
29 when they are rewritten in some combinations of re-writing tree
30 parsers. These issues will be corrected before release.
31
33 The ANTLRWorks debugger is now fully supported by this version of the
34 runtime. It supports remote debugging only (you cannot generate C,
35 compile and debug it from the ANTLRWorks IDE.) However both parser and
36 tree parser debugging is supported providing you are using a version of
37 ANTLRWorks that supports tree parser debugging. Generate the C code
38 with the -debug option of the ANTLR tool, as per any other target.
39
40 Note that when you invoke your debugging version of the parser, it will
41 appear to hang but is in fact waiting on a local TCP socket connection
42 from the ANTLRWorks debugger. As the target environment is unknown, it
43 is not prudent to generate notification status messages using something
44 like printf, as the target environment may not have a console or
45 implement printf.
46
48 Prior to the 3.1 release, accessing the token source of a lexer
49 required knowledge of where the token source pointer was located wihtin
50 the lexer. In 3.1, the token source was burried further in the innards
51 of the C runtime and such knowledge is considerd irreleavant and
52 confusing. Hence, when creating a token stream from a token source, it
53 is now mandatory to use the new C macro TOKENSOURCE(lxr), which will
54 expand to point at the token source interface. This MACRO will be
55 maintained across future versions. You can see how to use it in the
56 downloadable examples, avaiable from the downloads page of the ANTLR
57 web site. Here is the relevant code for creating a token stream,
58 extracted from those examples:
59
60 tstream = antlr3CommonTokenStreamSourceNew(ANTLR3_SIZE_HINT, TOKENSOURCE(lxr));
61
62Version 3.3.1 Tue Jan 26 2021 changes31(3)