XMLBooster's SWIG Code generator
Together with SWIG (http://www.swig.org),
one can use highly-optimized XMLBooster generated parsers from within dynamic
languages such as Python (Other similar scripting languages are to follow).
SWIG is a tool that exposes C libraries to a number of language and environments,
so that a highly optimized primitives can be combined seamlessly from within dynamic
and interactive languages, thereby aiming at providing the best of both worlds:
the performance of C and the flexibility and interactivity of interpreted environments.
The SWIG code generator included in XMLBooster is based on the following assumptions:
-
As one can expect, XMLBooster’s SWIG code generator
is based on its C code generator.
-
SWIG is a compiler that takes C declarations as input
and creates the wrappers needed to access those
declarations from other languages. The “.h” file
produced by XMLBOOSTER is therefore annotated with
special SWIG directives.
-
Even if most of the machinery is strictly identical across
target languages, XMLBooster has separate code generator
for each of the different SWIG target it supports so that
subtle differences can be taken into account.
-
XMLBooster (or rather, SWIG) generates objects in the
target scripting language to represent the data structures
of the underlying XML document. These objects are just
façades. SWIG creates accessor functions for each field of
each element, and these functions will ultimately read and
write field in the underlying C structure.
At the time of this writing, only Python is supported, other
targets are to be added in the near future.
|