source: CIVL/mods/dev.civl.abc/src/overview.html

main
Last change on this file was aad342c, checked in by Stephen Siegel <siegel@…>, 3 years ago

Performing huge refactor to incorporate ABC, GMC, and SARL into CIVL repo and use Java modules.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5664 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 8.0 KB
Line 
1
2<html>
3<body>
4
5 <p>Welcome to ABC, the ANTLR-Based C front-end. ABC is a Java
6 program for parsing and manipulating programs written in C and
7 possibly some languages extending C, such as CIVL-C. It can be used to
8 perform a number of tasks, including the following:
9 <ol>
10 <li>preprocess the source file(s)</li>
11 <li>parse the preprocessed source to form an Abstract Syntax Tree
12 representation of a translation unit</li>
13 <li>analyze an AST to determine the type of every expression, the
14 entity associated to every identifier, the scope of every node, and
15 so on</li>
16 <li>merge multiple ASTs into one large AST</li>
17 <li>transform ASTs, by, for example, removing expressions with
18 side-effects, renaming entities, pruning unreachable code, etc.</li>
19 </ol>
20 In addition, it provides a framework for developing your own analyses
21 or transformations on ASTs.
22 </p>
23
24 There is a simple command-line interface for ABC (see {@link
25 dev.civl.abc.ABC ABC}), but most users will want to use ABC
26 through its API. To use the API, it is helpful to have some
27 understanding of the modular structure of ABC. The ABC source code is
28 decomposed into modules, each with a well-defined interface and set of
29 responsibilities. Some of these modules are decomposed further into
30 sub-modules. The top-level modules are:
31 <ol>
32
33 <li><strong>util</strong>
34 <ol>
35 <li>responsibilities: simple general-purpose utility classes
36 that do not use other parts of ABC</li>
37 <li>uses: nothing</li>
38 <li>interface: {@link dev.civl.abc.util.IF}</li>
39 <li>entry point: none</li>
40 </ol></li>
41
42 <li><strong>config</strong>
43 <ol>
44 <li>responsibilities: representation of configuration
45 parameters for ABC</li>
46 <li>uses: nothing</li>
47 <li>interface: {@link dev.civl.abc.config.IF}</li>
48 <li>entry point: {@link
49 dev.civl.abc.config.IF.Configurations Configurations}</li>
50 </ol></li>
51
52 <li><strong>token</strong>
53 <ol>
54 <li>responsibilities: representing tokens; keeping track of the
55 origin and history of each token through macro expansion and
56 inclusion; representing characters and strings</li>
57 <li>uses: <strong>util</strong></li>
58 <li>interface: {@link dev.civl.abc.token.IF}</li>
59 <li>entry point: {@link dev.civl.abc.token.IF.Tokens
60 Tokens}</li>
61 </ol></li>
62
63 <li><strong>front</strong></li>
64 <ol>
65 <li>responsibilities: preprocessing and parsing a file to
66 produce an ANTLR tree representation of a translation unit</li>
67 <li>uses: <strong>util</strong>, <strong>config</strong>, <strong>token</strong></li>
68 <li>interface: {@link dev.civl.abc.front.IF},</li>
69 <li>entry point:</li>
70 <li>submodules
71 <ol>
72 <li><strong>preproc</strong>
73 <ol>
74 <li>responsibilities: preprocessing a file to generate a
75 post-preprocessor token stream</li>
76 <li>uses: <strong>util</strong>, <strong>config</strong>, <strong>token</strong></li>
77 <li>interface: {@link
78 dev.civl.abc.front.c.preproc.IF}, {@link
79 dev.civl.abc.front.fortran.preproc.IF}</li>
80 <li>entry point: {@link
81 dev.civl.abc.front.c.preproc.IF.Preprocess Preprocess},
82 {@link dev.civl.abc.front.fortran.preproc.IF.Preprocess
83 Preprocess}</li>
84 </ol></li>
85
86 <li><strong>parse</strong>
87 <ol>
88 <li>responsibilities: parsing a token stream to produce an
89 ANTLR tree representation of a translation unit</li>
90 <li>uses: <strong>util</strong>, <strong>config</strong>, <strong>token</strong></li>
91 <li>interface: {@link
92 dev.civl.abc.front.c.parse.IF}, {@link
93 dev.civl.abc.front.fortran.parse.IF}</li>
94 <li>entry point: {@link
95 dev.civl.abc.front.c.parse.IF.Parse Parse}, {@link
96 dev.civl.abc.front.fortran.parse.IF.Parse Parse}</li>
97 </ol></li>
98 <li>ptree</li>
99 </ol>
100 </li>
101 </ol>
102
103
104 <li><strong>ast</strong>
105 <ol>
106 <li>responsibilities: representation and manipulation of an
107 Abstract Syntax Tree and associated entities</li>
108 <li>uses: <strong>util</strong>, <strong>token</strong></li>
109 <li>interface: {@link dev.civl.abc.ast.IF}</li>
110 <li>entry point: {@link dev.civl.abc.ast.IF.ASTs ASTs}</li>
111 <li>submodules
112 <ol>
113 <li><strong>value</strong>
114 <ol>
115 <li>responsibilities: representation of concrete value,
116 such as characters, integers, floating point values</li>
117 <li>interface: {@link dev.civl.abc.ast.value.IF}</li>
118 <li>entry point: {@link
119 dev.civl.abc.ast.value.IF.Values Values}</li>
120 </ol></li>
121 <li><strong>type</strong>
122 <ol>
123 <li>responsibilities: representation of types</li>
124 <li>interface: {@link dev.civl.abc.ast.type.IF}</li>
125 <li>entry point: {@link
126 dev.civl.abc.ast.type.IF.Types Types}</li>
127 </ol></li>
128 <li><strong>entity</strong>
129 <ol>
130 <li>responsibilities: representation of abstract program
131 entities which can be named by an identifier, including
132 variables, functions, labels, scopes, structures, unions,
133 enumerations, enumerators, and typedefs</li>
134 <li>interface: {@link dev.civl.abc.ast.entity.IF}</li>
135 <li>entry point: {@link
136 dev.civl.abc.ast.entity.IF.Entities Entities}</li>
137 </ol></li>
138 <li><strong>conversion</strong>
139 <ol>
140 <li>responsibilities: representation of C's implicit
141 conversions, such as the conversion of an array to a pointer to
142 the first element of the array, and so on</li>
143 <li>interface: {@link
144 dev.civl.abc.ast.conversion.IF}</li>
145 <li>entry point: {@link
146 dev.civl.abc.ast.conversion.IF.Conversions Conversions}
147
148
149
150
151
152
153
154
155
156
157
158
159
160 </ol></li>
161 <li><strong>node</strong>
162 <ol>
163 <li>responsibilities: representation of AST nodes</li>
164 <li>interface: {@link dev.civl.abc.ast.node.IF}</li>
165 <li>entry point: {@link
166 dev.civl.abc.ast.node.IF.Nodes Nodes}</li>
167 </ol></li>
168 </ol>
169 </li>
170 </ol></li>
171
172 <li><strong>astgen</strong>
173 <ol>
174 <li>responsibilities: translation of ANTLR tree to AST</li>
175 <li>uses: <strong>util</strong>, <strong>token</strong>, </strong><strong>front</strong>,
176 <strong>ast</strong></li>
177 <li>interface: {@link dev.civl.abc.astgen.IF}, {@link
178 dev.civl.abc.astgen.c.IF}, {@link
179 dev.civl.abc.astgen.fortran.IF}</li>
180 <li>entry point: {@link
181 dev.civl.abc.astgen.IF.ASTGenerator}</li>
182 </ol></li>
183
184 <li><strong>analysis</strong>
185 <ol>
186 <li>responsibilities: analyzing AST, creation of entities,
187 resolution of all identifiers, determination of all scopes, types,
188 and entities</li>
189 <li>uses: <strong>config</strong>, <strong>token</strong>, <strong>ast</strong></li>
190 <li>interface: {@link dev.civl.abc.analysis.IF}</li>
191 <li>entry point: {@link
192 dev.civl.abc.analysis.IF.Analysis Analysis}</li>
193 </ol></li>
194
195 <li><strong>transform</strong>
196 <ol>
197 <li>responsibilities: transformations of an AST</li>
198 <li>uses: <strong>token</strong>, <strong>ast</strong></li>
199 <li>interface: {@link dev.civl.abc.transform.IF}</li>
200 <li>entry point: {@link
201 dev.civl.abc.transform.IF.Transform Transform}</li>
202 </ol></li>
203
204 <li><strong>program</strong>
205 <ol>
206 <li>responsibilities: mutable representation of a program</li>
207 <li>uses: <strong>token</strong>, <strong>ast</strong>, <strong>analysis</strong>,
208 <strong>transform</strong></li>
209 <li>interface: {@link dev.civl.abc.program.IF}</li>
210 <li>entry point: {@link
211 dev.civl.abc.program.IF.Programs Programs}</li>
212 </ol></li>
213
214 <li><strong>main</strong>
215 <ol>
216 <li>responsibilities: command line interface, Activator class
217 for marshaling of tools in tool chain</li>
218 <li>uses: <strong>util</strong>, <strong>token</strong>, <strong>front</strong>,
219 <strong>ast</strong>, <strong>astgen</strong>, <strong>analysis</strong>,
220 <strong>transform</strong>, <strong>program</strong>
221 </li>
222 <li>interface: {@link dev.civl.abc}</li>
223 <li>entry point: {@link dev.civl.abc.ABC ABC}</li>
224 </ol></li>
225
226 </ol>
227
228</body>
229</html>
230
Note: See TracBrowser for help on using the repository browser.