GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/printer/ast/ast_printer.h Lines: 1 1 100.0 %
Date: 2021-08-16 Branches: 0 0 0.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Abdalrhman Mohamed, Andrew Reynolds, Tim King
4
 *
5
 * This file is part of the cvc5 project.
6
 *
7
 * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
8
 * in the top-level source directory and their institutional affiliations.
9
 * All rights reserved.  See the file COPYING in the top-level source
10
 * directory for licensing information.
11
 * ****************************************************************************
12
 *
13
 * The pretty-printer interface for the AST output language.
14
 */
15
16
#include "cvc5_private.h"
17
18
#ifndef CVC5__PRINTER__AST_PRINTER_H
19
#define CVC5__PRINTER__AST_PRINTER_H
20
21
#include <iostream>
22
23
#include "printer/printer.h"
24
25
namespace cvc5 {
26
27
class LetBinding;
28
29
namespace printer {
30
namespace ast {
31
32
12
class AstPrinter : public cvc5::Printer
33
{
34
 public:
35
  using cvc5::Printer::toStream;
36
  void toStream(std::ostream& out,
37
                TNode n,
38
                int toDepth,
39
                size_t dag) const override;
40
  void toStream(std::ostream& out, const CommandStatus* s) const override;
41
  void toStream(std::ostream& out, const smt::Model& m) const override;
42
43
  /** Print empty command */
44
  void toStreamCmdEmpty(std::ostream& out,
45
                        const std::string& name) const override;
46
47
  /** Print echo command */
48
  void toStreamCmdEcho(std::ostream& out,
49
                       const std::string& output) const override;
50
51
  /** Print assert command */
52
  void toStreamCmdAssert(std::ostream& out, Node n) const override;
53
54
  /** Print push command */
55
  void toStreamCmdPush(std::ostream& out) const override;
56
57
  /** Print pop command */
58
  void toStreamCmdPop(std::ostream& out) const override;
59
60
  /** Print declare-fun command */
61
  void toStreamCmdDeclareFunction(std::ostream& out,
62
                                  const std::string& id,
63
                                  TypeNode type) const override;
64
65
  /** Print declare-sort command */
66
  void toStreamCmdDeclareType(std::ostream& out,
67
                              TypeNode type) const override;
68
69
  /** Print define-sort command */
70
  void toStreamCmdDefineType(std::ostream& out,
71
                             const std::string& id,
72
                             const std::vector<TypeNode>& params,
73
                             TypeNode t) const override;
74
75
  /** Print define-fun command */
76
  void toStreamCmdDefineFunction(std::ostream& out,
77
                                 const std::string& id,
78
                                 const std::vector<Node>& formals,
79
                                 TypeNode range,
80
                                 Node formula) const override;
81
82
  /** Print check-sat command */
83
  void toStreamCmdCheckSat(std::ostream& out,
84
                           Node n = Node::null()) const override;
85
86
  /** Print check-sat-assuming command */
87
  void toStreamCmdCheckSatAssuming(
88
      std::ostream& out, const std::vector<Node>& nodes) const override;
89
90
  /** Print query command */
91
  void toStreamCmdQuery(std::ostream& out, Node n) const override;
92
93
  /** Print simplify command */
94
  void toStreamCmdSimplify(std::ostream& out, Node nodes) const override;
95
96
  /** Print get-value command */
97
  void toStreamCmdGetValue(std::ostream& out,
98
                           const std::vector<Node>& n) const override;
99
100
  /** Print get-assignment command */
101
  void toStreamCmdGetAssignment(std::ostream& out) const override;
102
103
  /** Print get-model command */
104
  void toStreamCmdGetModel(std::ostream& out) const override;
105
106
  /** Print get-proof command */
107
  void toStreamCmdGetProof(std::ostream& out) const override;
108
109
  /** Print get-unsat-core command */
110
  void toStreamCmdGetUnsatCore(std::ostream& out) const override;
111
112
  /** Print get-assertions command */
113
  void toStreamCmdGetAssertions(std::ostream& out) const override;
114
115
  /** Print set-info :status command */
116
  void toStreamCmdSetBenchmarkStatus(std::ostream& out,
117
                                     Result::Sat status) const override;
118
119
  /** Print set-logic command */
120
  void toStreamCmdSetBenchmarkLogic(std::ostream& out,
121
                                    const std::string& logic) const override;
122
123
  /** Print set-info command */
124
  void toStreamCmdSetInfo(std::ostream& out,
125
                          const std::string& flag,
126
                          const std::string& value) const override;
127
128
  /** Print get-info command */
129
  void toStreamCmdGetInfo(std::ostream& out,
130
                          const std::string& flag) const override;
131
132
  /** Print set-option command */
133
  void toStreamCmdSetOption(std::ostream& out,
134
                            const std::string& flag,
135
                            const std::string& value) const override;
136
137
  /** Print get-option command */
138
  void toStreamCmdGetOption(std::ostream& out,
139
                            const std::string& flag) const override;
140
141
  /** Print declare-datatype(s) command */
142
  void toStreamCmdDatatypeDeclaration(
143
      std::ostream& out, const std::vector<TypeNode>& datatypes) const override;
144
145
  /** Print reset command */
146
  void toStreamCmdReset(std::ostream& out) const override;
147
148
  /** Print reset-assertions command */
149
  void toStreamCmdResetAssertions(std::ostream& out) const override;
150
151
  /** Print quit command */
152
  void toStreamCmdQuit(std::ostream& out) const override;
153
154
  /** Print comment command */
155
  void toStreamCmdComment(std::ostream& out,
156
                          const std::string& comment) const override;
157
158
  /** Print command sequence command */
159
  void toStreamCmdCommandSequence(
160
      std::ostream& out, const std::vector<Command*>& sequence) const override;
161
162
  /** Print declaration sequence command */
163
  void toStreamCmdDeclarationSequence(
164
      std::ostream& out, const std::vector<Command*>& sequence) const override;
165
166
 private:
167
  void toStream(std::ostream& out,
168
                TNode n,
169
                int toDepth,
170
                LetBinding* lbind = nullptr) const;
171
  /**
172
   * To stream model sort. This prints the appropriate output for type
173
   * tn declared via declare-sort or declare-datatype.
174
   */
175
  void toStreamModelSort(std::ostream& out,
176
                         const smt::Model& m,
177
                         TypeNode tn) const override;
178
179
  /**
180
   * To stream model term. This prints the appropriate output for term
181
   * n declared via declare-fun.
182
   */
183
  void toStreamModelTerm(std::ostream& out,
184
                         const smt::Model& m,
185
                         Node n) const override;
186
  /**
187
   * To stream with let binding. This prints n, possibly in the scope
188
   * of letification generated by this method based on lbind.
189
   */
190
  void toStreamWithLetify(std::ostream& out,
191
                          Node n,
192
                          int toDepth,
193
                          LetBinding* lbind) const;
194
}; /* class AstPrinter */
195
196
}  // namespace ast
197
}  // namespace printer
198
}  // namespace cvc5
199
200
#endif /* CVC5__PRINTER__AST_PRINTER_H */