This package contains definitions for common functions that are useful for symbolic expression manipulation. This package is a simplified fork of TermInterface.jl
You should define the following methods for an abstract syntax tree to implement SyntaxInterface.jl
Check if x
represents an expression tree. If returns true, it will be assumed
that operation(::T)
and arguments(::T)
methods are defined.
Returns the operation, or head, performed by an expression tree node. If x
represents a function call, for example, the head might represent
the function being called. Called
only if istree(::T)
is true.
Returns the arguments, or children, to an expression tree node. Called only if istree(x)
is true
.
In addition, the methods for Base.hash
and Base.isequal
should also be implemented by the types for the purposes of substitution and equality matching respectively.
Construct a new term with the operation f
and arguments args
, the term
should be similar to x
in type. If not specified, the result is computed as
f(args...)
. This method helps avoid splatting. To define this method for your
term type, define similarterm(::Type{<:T}, ...)
.