19 const std::string
buf;
35 void skip(
const std::string& s =
" \t\n\r");
37 void skip_m(
const std::string& s);
41 bool is_end(
size_t pos)
const;
45 std::string
head_word(
const std::string& s =
" \t\n\r")
const;
47 void expect(
const std::string& c)
const;
49 size_t next(
const std::string& s)
const;
51 size_t next(
const std::string& s,
size_t pos)
const;
53 void accept(
const std::string& s);
69 virtual std::string
toString()
const = 0;
72 typedef std::shared_ptr<smt_item> smt_item_ptr;
78 virtual std::string
toString()
const override;
84 enum tp { Bool, BV, Datatype } _type;
95 static std::string
toString(
const std::vector<var_type>&);
111 var_type(
tp vtype,
unsigned width,
const std::string mod_name);
133 const std::string& default_module_name);
138 typedef std::map<std::string, std::vector<state_var_t>> datatypes_t;
140 typedef std::vector<std::string> data_type_order_t;
151 std::string toString()
const;
153 static std::string toString(
const std::vector<arg_t>& va);
176 virtual std::string
toString()
const override;
197 std::string ParseFromString(
str_iterator& it, datatypes_t& dtype);
202 std::string convert_to_binary(
unsigned v,
unsigned w);
204 std::string convert_to_binary(
const std::string& v,
unsigned radix,
unsigned w);
208 #endif // SMT_AST_H__
static bool eqtype(const var_type &l, const var_type &r)
whether the types are the same
std::string func_module
func_module
Definition: smt_ast.h:163
var_type _type
its type
Definition: smt_ast.h:128
void jump_to_next(const std::string &c)
jump to the start of symbol c
std::string readline_no_eol()
static state_var_t ParseFromString(str_iterator &, const std::string &default_module_name)
contruct from
void accept(const std::string &s)
accept a token (expect and skip)
std::string toString() const
convert to string
str_iterator(const std::string &, size_t p=0)
constructor 1
static var_type ParseFromString(str_iterator &)
contruct from
char head() const
return the first
size_t pnt
the pointer
Definition: smt_ast.h:21
std::string func_body
its content – will be replaced
Definition: smt_ast.h:171
size_t next_non_space_pos(const std::string &s=" \t\n\r") const
returns the next non space pos
the class that holds the whole file
Definition: smt_ast.h:183
unsigned _width
bitwidth
Definition: smt_ast.h:86
std::string accept_current_and_read_untill(const std::string &delimiter)
and item in declare-datatype
Definition: smt_ast.h:120
virtual std::string toString() const override
output to string
bool is_datatype() const
test if it is bv
virtual std::string toString() const =0
output to string
std::string head_word(const std::string &s=" \t\n\r") const
return the head_word (if it the end, then empty string)
static arg_t ParseFromString(str_iterator &)
construct from input string
static void ParseFromString(str_iterator &, func_def_t &)
parse from file, but will not return but use a reference
var_type ret_type
its return type
Definition: smt_ast.h:169
the type Bool or (_ BitVec)
Definition: smt_ast.h:82
std::string args_text
the initial args text, will be replaced by state_var_vec
Definition: smt_ast.h:165
var_type arg_type
arg type // from the type
Definition: smt_ast.h:147
unsigned GetBoolBvWidth() const
return a verilog-use width
void skip_m(const std::string &s)
skip a symbol (w. blank also)
datatypes_t datatypes
the data types include in the smt_file
Definition: smt_ast.h:187
void expect(const std::string &c) const
expect the head token to be 'c'
std::string arg_name
argument's name // from internal name
Definition: smt_ast.h:145
std::string toString() const
output to string
bool is_bool() const
test if it is bv
string iterator
Definition: smt_ast.h:17
std::string verilog_name
verilog name (not including )
Definition: smt_ast.h:126
void skip(const std::string &s=" \t\n\r")
skip some single charactor symbol
std::string read_till_pos(size_t pos)
read untill a pos
size_t next(const std::string &s) const
get the closest occurance of s from current point
std::string extract_untill_stack_empty(char push_symbol, char pop_symbol)
read until the stack is empty
a function
Definition: smt_ast.h:159
std::vector< arg_t > args
arguments
Definition: smt_ast.h:167
argument used in a function def
Definition: smt_ast.h:143
std::string module_name
its datatype name (not including | _s|)
Definition: smt_ast.h:88
tp
type
Definition: smt_ast.h:84
const std::string buf
the buffer
Definition: smt_ast.h:19
data_type_order_t data_type_order
Definition: smt_ast.h:190
std::string func_name
func name
Definition: smt_ast.h:161
std::string extra_comment
extra comment (optional)
Definition: smt_ast.h:173
std::vector< smt_item_ptr > items
collection of smt_items
Definition: smt_ast.h:185
std::string module_name
module_name
Definition: smt_ast.h:124
std::string internal_name
|module_name|...
Definition: smt_ast.h:122
bool is_bv() const
test if it is bv