Z3
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Data Structures | Public Member Functions | Static Public Member Functions | Properties
AST Class Reference

The abstract syntax tree (AST) class. More...

+ Inheritance diagram for AST:

Data Structures

class  DecRefQueue
 

Public Member Functions

override bool Equals (object o)
 Object comparison. More...
 
virtual int CompareTo (object other)
 Object Comparison. More...
 
override int GetHashCode ()
 The AST's hash code. More...
 
AST Translate (Context ctx)
 Translates (copies) the AST to the Context ctx . More...
 
override string ToString ()
 A string representation of the AST. More...
 
string SExpr ()
 A string representation of the AST in s-expression notation. More...
 
- Public Member Functions inherited from Z3Object
void Dispose ()
 Disposes of the underlying native Z3 object. More...
 

Static Public Member Functions

static bool operator== (AST a, AST b)
 Comparison operator. More...
 
static bool operator!= (AST a, AST b)
 Comparison operator. More...
 

Properties

uint Id [get]
 A unique identifier for the AST (unique among all ASTs). More...
 
Z3_ast_kind ASTKind [get]
 The kind of the AST. More...
 
bool IsExpr [get]
 Indicates whether the AST is an Expr More...
 
bool IsApp [get]
 Indicates whether the AST is an application More...
 
bool IsVar [get]
 Indicates whether the AST is a BoundVariable More...
 
bool IsQuantifier [get]
 Indicates whether the AST is a Quantifier More...
 
bool IsSort [get]
 Indicates whether the AST is a Sort More...
 
bool IsFuncDecl [get]
 Indicates whether the AST is a FunctionDeclaration More...
 

Detailed Description

The abstract syntax tree (AST) class.

Definition at line 31 of file AST.cs.

Member Function Documentation

virtual int CompareTo ( object  other)
inlinevirtual

Object Comparison.

Parameters
otherAnother AST
Returns
Negative if the object should be sorted before other , positive if after else zero.

Definition at line 76 of file AST.cs.

77  {
78  if (other == null) return 1;
79  AST oAST = other as AST;
80  if (oAST == null)
81  return 1;
82  else
83  {
84  if (Id < oAST.Id)
85  return -1;
86  else if (Id > oAST.Id)
87  return +1;
88  else
89  return 0;
90  }
91  }
uint Id
A unique identifier for the AST (unique among all ASTs).
Definition: AST.cs:106
override bool Equals ( object  o)
inline

Object comparison.

Definition at line 64 of file AST.cs.

65  {
66  AST casted = o as AST;
67  if (casted == null) return false;
68  return this == casted;
69  }
override int GetHashCode ( )
inline

The AST's hash code.

Returns
A hash code

Definition at line 97 of file AST.cs.

98  {
99  return (int)Native.Z3_get_ast_hash(Context.nCtx, NativeObject);
100  }
static bool operator!= ( AST  a,
AST  b 
)
inlinestatic

Comparison operator.

Parameters
aAn AST
bAn AST
Returns
True if a and b are not from the same context or represent different sorts; false otherwise.

Definition at line 56 of file AST.cs.

57  {
58  return !(a == b);
59  }
static bool operator== ( AST  a,
AST  b 
)
inlinestatic

Comparison operator.

Parameters
aAn AST
bAn AST
Returns
True if a and b are from the same context and represent the same sort; false otherwise.

Definition at line 40 of file AST.cs.

41  {
42  return Object.ReferenceEquals(a, b) ||
43  (!Object.ReferenceEquals(a, null) &&
44  !Object.ReferenceEquals(b, null) &&
45  a.Context.nCtx == b.Context.nCtx &&
46  Native.Z3_is_eq_ast(a.Context.nCtx, a.NativeObject, b.NativeObject) != 0);
47  }
string SExpr ( )
inline

A string representation of the AST in s-expression notation.

Definition at line 203 of file AST.cs.

204  {
205  Contract.Ensures(Contract.Result<string>() != null);
206 
207  return Native.Z3_ast_to_string(Context.nCtx, NativeObject);
208  }
override string ToString ( )
inline

A string representation of the AST.

Definition at line 195 of file AST.cs.

196  {
197  return Native.Z3_ast_to_string(Context.nCtx, NativeObject);
198  }
AST Translate ( Context  ctx)
inline

Translates (copies) the AST to the Context ctx .

Parameters
ctxA context
Returns
A copy of the AST which is associated with ctx

Definition at line 115 of file AST.cs.

116  {
117  Contract.Requires(ctx != null);
118  Contract.Ensures(Contract.Result<AST>() != null);
119 
120  if (ReferenceEquals(Context, ctx))
121  return this;
122  else
123  return new AST(ctx, Native.Z3_translate(Context.nCtx, NativeObject, ctx.nCtx));
124  }

Property Documentation

Z3_ast_kind ASTKind
get

The kind of the AST.

Definition at line 130 of file AST.cs.

uint Id
get

A unique identifier for the AST (unique among all ASTs).

Definition at line 106 of file AST.cs.

Referenced by AST.CompareTo().

bool IsApp
get

Indicates whether the AST is an application

Definition at line 156 of file AST.cs.

bool IsExpr
get

Indicates whether the AST is an Expr

Definition at line 138 of file AST.cs.

bool IsFuncDecl
get

Indicates whether the AST is a FunctionDeclaration

Definition at line 188 of file AST.cs.

bool IsQuantifier
get

Indicates whether the AST is a Quantifier

Definition at line 172 of file AST.cs.

bool IsSort
get

Indicates whether the AST is a Sort

Definition at line 180 of file AST.cs.

bool IsVar
get

Indicates whether the AST is a BoundVariable

Definition at line 164 of file AST.cs.