libSBML Perl API
libSBML 5.10.0 Perl API
|
"1 +
2"
is represented as an AST with one plus node having two integer children nodes for the numbers 1
and 2
. The figure also shows the corresponding MathML representation:Infix | AST | MathML |
---|---|---|
1 + 2
|
<math xmlns="http://www.w3.org/1998/Math/MathML"> <apply> <plus/> <cn type="integer"> 1 </cn> <cn type="integer"> 2 </cn> </apply> </math>
|
The following are other noteworthy points about the AST representation in libSBML:
For many applications, the details of ASTs are irrelevant because the applications can use the text-string based translation functions such as . If you find the complexity of using the AST representation of expressions too high for your purposes, perhaps the string-based functions will be more suitable.
Finally, it is worth noting that the AST and MathML handling code in libSBML remains written in C, not C++. (All of libSBML was originally written in C.) Readers may occasionally wonder why some aspects are more C-like and less object oriented, and that's one of the reasons.