Welcome to ABC, the ANTLR-Based C front-end. ABC is a Java program for parsing and manipulating programs written in C and possibly some languages extending C, such as CIVL-C. It can be used to perform a number of tasks, including the following:
- preprocess the source file(s)
- parse the preprocessed source to form an Abstract Syntax Tree representation of a translation unit
- analyze an AST to determine the type of every expression, the entity associated to every identifier, the scope of every node, and so on
- merge multiple ASTs into one large AST
- transform ASTs, by, for example, removing expressions with side-effects, renaming entities, pruning unreachable code, etc.
ABC
), but most users will want to use ABC
through its API. To use the API, it is helpful to have some
understanding of the modular structure of ABC. The ABC source code is
decomposed into modules, each with a well-defined interface and set of
responsibilities. Some of these modules are decomposed further into
sub-modules. The top-level modules are:
- util
- responsibilities: simple general-purpose utility classes that do not use other parts of ABC
- uses: nothing
- interface:
edu.udel.cis.vsl.abc.util.IF
- entry point: none
- config
- responsibilities: representation of configuration parameters for ABC
- uses: nothing
- interface:
edu.udel.cis.vsl.abc.config.IF
- entry point:
Configurations
- token
- responsibilities: representing tokens; keeping track of the origin and history of each token through macro expansion and inclusion; representing characters and strings
- uses: util
- interface:
edu.udel.cis.vsl.abc.token.IF
- entry point:
Tokens
- front
- responsibilities: preprocessing and parsing a file to produce an ANTLR tree representation of a translation unit
- uses: util, config, token
- interface:
edu.udel.cis.vsl.abc.front.IF
, - entry point:
- submodules
- preproc
- responsibilities: preprocessing a file to generate a post-preprocessor token stream
- uses: util, config, token
- interface:
edu.udel.cis.vsl.abc.front.c.preproc.IF
,edu.udel.cis.vsl.abc.front.fortran.preproc.IF
- entry point:
Preprocess
,Preprocess
- parse
- responsibilities: parsing a token stream to produce an ANTLR tree representation of a translation unit
- uses: util, config, token
- interface:
edu.udel.cis.vsl.abc.front.c.parse.IF
,edu.udel.cis.vsl.abc.front.fortran.parse.IF
- entry point:
Parse
,Parse
- ptree
- preproc
- ast
- responsibilities: representation and manipulation of an Abstract Syntax Tree and associated entities
- uses: util, token
- interface:
edu.udel.cis.vsl.abc.ast.IF
- entry point:
ASTs
- submodules
- value
- responsibilities: representation of concrete value, such as characters, integers, floating point values
- interface:
edu.udel.cis.vsl.abc.ast.value.IF
- entry point:
Values
- type
- responsibilities: representation of types
- interface:
edu.udel.cis.vsl.abc.ast.type.IF
- entry point:
Types
- entity
- responsibilities: representation of abstract program entities which can be named by an identifier, including variables, functions, labels, scopes, structures, unions, enumerations, enumerators, and typedefs
- interface:
edu.udel.cis.vsl.abc.ast.entity.IF
- entry point:
Entities
- conversion
- responsibilities: representation of C's implicit conversions, such as the conversion of an array to a pointer to the first element of the array, and so on
- interface:
edu.udel.cis.vsl.abc.ast.conversion.IF
- entry point:
Conversions
- node
- responsibilities: representation of AST nodes
- interface:
edu.udel.cis.vsl.abc.ast.node.IF
- entry point:
Nodes
- value
- astgen
- responsibilities: translation of ANTLR tree to AST
- uses: util, token, front, ast
- interface:
edu.udel.cis.vsl.abc.astgen.IF
,edu.udel.cis.vsl.abc.astgen.c.IF
,edu.udel.cis.vsl.abc.astgen.fortran.IF
- entry point:
edu.udel.cis.vsl.abc.astgen.IF.ASTGenerator
- analysis
- responsibilities: analyzing AST, creation of entities, resolution of all identifiers, determination of all scopes, types, and entities
- uses: config, token, ast
- interface:
edu.udel.cis.vsl.abc.analysis.IF
- entry point:
Analysis
- transform
- responsibilities: transformations of an AST
- uses: token, ast
- interface:
edu.udel.cis.vsl.abc.transform.IF
- entry point:
Transform
- program
- responsibilities: mutable representation of a program
- uses: token, ast, analysis, transform
- interface:
edu.udel.cis.vsl.abc.program.IF
- entry point:
Programs
- main
- responsibilities: command line interface, Activator class for marshaling of tools in tool chain
- uses: util, token, front, ast, astgen, analysis, transform, program
- interface:
edu.udel.cis.vsl.abc
- entry point:
ABC
Packages
Package
Description
The analysis module provides various algorithms which
analyze an AST, leaving behind information about the AST.
Submodule ast.conversion provides classes for representing
to C's "implicit conversions".
Submodule ast.entity defines entities
(objects of type
Entity
),
the abstract things such as types, structures, unions, enumerations,
objects (variables), functions, and so on,
which can be named by identifiers in a program.Module ast defines an Abstract Syntax Tree
representation of a program, the
AST
.Submodule ast.node defines every kind of
node in an AST.
The ast.node.compound submodule
defines nodes and related classes for representing
compound initializers.
The ast.node.declaration submodule defines nodes
and other object deadling with declarations in a program.
The ast.node.expression submodule defines AST nodes
for representing expressions in a program.
The ast.node.label submodule defines AST nodes for representing labels
in a program, including ordinary labels, and the
case
and default
labels used in switch
statements.The ast.node.omp submodule defines AST nodes for representing
OpenMP constructs, which are specified in
omp
pragmas.The ast.node.statement submodule defines AST
nodes for representing statements in a program.
The ast.node.type submodule defines AST nodes
for representing type constructs in a program.
The ast.type submodule defines the (abstract) types
that can be specified in a program.
The ast.value submodule defines classes for representing
constant values that can occur in a program, such as numeric literals,
characters, strings, pointer constants, and so on.
Module config defines a configuration of ABC
which specifies things such as the language be parsed, bounds on
integer types, and so on.
Module err provides general exception classes that
can be thrown by ABC.
Module parse is used to parse a token stream and
produce an ANTLR tree representation of a C program.
Module program provides a high-level, mutable,
representation of a program.
Module token defines the various kinds of tokens and related
classes used by ABC.
Module transform defines various kinds of transformations
of an AST.
Module util provides various general-purpose utilities used by
ABC.