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