Abstract Syntax Tree (AST) is a technology to hold source code information. It is object-oriented and the main purpose is that for each term in the souce code there is an AST node. However, if all grammar terms for Java or even C++ should be programmed in an AST implementation, then number of AST nodes should be relatively large. Therefore, number of nodes is optimized in typical cases. Unfortunately, combining many terms to an AST node makes its semantic complex, and the result is far from an ideal solution.

A large AST implementation can be found made by Antlr: http://www.antlr2.org/javadoc/antlr/collections/AST.html

There are many drawbacks in a typical AST implementation, programmed in an imperative language:

  • The contents of each node has been splitted in numerous variables of the node. Therefore, it is not possible to use node’s contents as an information for queries: what is the meaning of this node, what are the subnodes of the node etc.
  • Because the contents (definition) for an AST – node is not formal, it is not possible to use the symbol as an explanation for program proving purposes.
  • Often AST – implementations are too heavy to be used in programming. The class hierarchy for an AST class is rather deep, which hundreds of methods.
  • Because AST is not formal, it is not possible to easily write an executable model based on AST.

Instead, the atomistic symbolic model contains symbols that have a command to contain each semantics (see ModelWare). This model is executable and formal (see SimulationWare).

Advertisements