1generate(3)                         ANTLR3C                        generate(3)
2
3
4

NAME

6       generate - .TH "generate" 3 "Wed Oct 13 2010" "Version 3.1.2" "ANTLR3C"
7

NAME

9       generate - .SH "Generating Code for the C Target"
10
11       Before discussing how we compile or call the generated C code, we need
12       to know how to invoke the C code generator. This is achieved within the
13       grammar file itself, using the language option:
14
15       options { language = C;}
16
17       The code generator consists of a single .java file within the standard
18       ANTLR tool jar, and a code generation template, used by the
19       StringTemplate engine, which drives code generation for all language
20       targets. In fact you can make copies of the C.stg and AST.stg templates
21       and make changes to them (though you are encouraged not to, as it is
22       better to provide bug fixes or enhancements which we are happy to
23       receive requests for and will do out best to incorporate.
24
25       If you are working in the Windows environment, with Visual Studio 2005
26       or later, you may wish to utilize the custom rulefile provided in the C
27       source code distribution under the ./vs2005 directory for this purpose.
28       If you are using a pre-built library then you can also download this
29       rule file directly from the FishEye source code browser for ANTLR3.
30
31       In order to use the rulefile, you must adopt the following suffixes for
32       your grammar files, though they are otherwise optional:
33
34       Suffix  Grammar should contain...   .g3l  A lexer grammar specification
35       only.   .g3p  A parser grammar specification only.   .g3pl  A combined
36       lexer and parser specification.   .g3t  A tree grammar specification.
37
38       You may also wish to use these suffixes if you are building your
39       projects using Makefiles, as this makes the output deterministic.
40       However in this case a much better solution is probably to utilize the
41       -depend option of the Antlr tool, which should tell your Makefile what
42       the grammar files generates, irrespective of its suffix. ANTLR does not
43       care about the actual suffix you use for your grammar file, so building
44       for multiple platforms is relatively easy.
45
46       NOTE: Your grammar source, regardless of suffix must be named the same
47       as the grammar statement within it. Grammar xyz must be contained
48       within a file called xyz.anything
49
50
51
52Version 3.1.2                   Wed Oct 13 2010                    generate(3)
Impressum