Skip to content

Commit

Permalink
DataflowAPI manual writing
Browse files Browse the repository at this point in the history
  • Loading branch information
mxz297 committed Jun 3, 2016
1 parent e61e4a3 commit da7c751
Show file tree
Hide file tree
Showing 18 changed files with 1,310 additions and 221 deletions.
22 changes: 0 additions & 22 deletions dataflowAPI/doc/API-template.tex

This file was deleted.

61 changes: 0 additions & 61 deletions dataflowAPI/doc/API/template.tex

This file was deleted.

81 changes: 81 additions & 0 deletions dataflowAPI/doc/AST.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
\subsection{Class AST}
\label{sec:ast}
\definedin{DynAST.h}

We provide a generic AST framework to represent tree structures.
One example use case is to represent instruction semantics with symbolic expressions.
This AST framework include the base class definitions for tree nodes and visitors.
Users can inherit tree node classes to create their own AST structure and
AST visitors to write their own analyses for the AST.

All AST node classes should be derived from class AST and currently we have the
following types of AST nodes.

\begin{center}
\begin{tabular}{ll}
\toprule
AST::ID & Meaning \\
\midrule
V\_AST & Base class type \\
V\_BottomAST & Bottom AST node \\
V\_ConstantAST & Constant AST node \\
V\_VariableAST & Variable AST node \\
V\_RoseAST & ROSEOperation AST node \\
V\_StackAST & Stack AST node \\
\bottomrule
\end{tabular}
\end{center}

\begin{apient}
typedef boost::shared_ptr<AST> Ptr;
\end{apient}
\apidesc{Shared pointer for class AST.}

\begin{apient}
typedef std::vector<AST::Ptr> Children;
\end{apient}
\apidesc{The container type for the children of this AST.}

\begin{apient}
bool operator==(const AST &rhs) const;
bool equals(AST::Ptr rhs);
\end{apient}
\apidesc{Check whether two AST nodes are equal. Return \code{true} when two
nodes are in the same type and are equal according to the \code{==} operator of that type.}

\begin{apient}
virtual unsigned numChildren() const;
\end{apient}
\apidesc{Return the number of children of this node.}

\begin{apient}
virtual AST::Ptr child(unsigned i) const;
\end{apient}
\apidesc{Return the \code{i}th child.}

\begin{apient}
virtual const std::string format() const = 0;
\end{apient}
\apidesc{Return the string representation of the node.}

\begin{apient}
static AST::Ptr substitute(AST::Ptr in, AST::Ptr a, AST::Ptr b);
\end{apient}
\apidesc{Substitute every occurrence of \code{a} with \code{b} in AST \code{in}.
Return a new AST after the substitution.}

\begin{apient}
virtual AST::ID AST::getID() const;
\end{apient}
\apidesc{Return the class type ID of this node.}

\begin{apient}
virtual Ptr accept(ASTVisitor *v);
\end{apient}
\apidesc{Apply visitor \code{v} to this node. Note that this method will not
automatically apply the visitor to its children.}

\begin{apient}
virtual void AST::setChild(int i, AST::Ptr c);
\end{apient}
\apidesc{Set the \code{i}th child of this node to \code{c}.}

0 comments on commit da7c751

Please sign in to comment.