ROSE  0.9.10.54
Classes | Public Types | Public Member Functions | List of all members
Rose::BinaryAnalysis::SymbolicExprParser Class Reference

Description

Parses symbolic expressions from text.

Parses symbolic expressions using a simple LISP-like syntax, the same syntax used by the unparser. An expression can be a numeric constant with an optional negative sign, a hexadecimal bit vector, a numbered variable like "v123", a named variable, or an operator with arguments. Operators are expressed as an operator name and space-separated arguments; the operator and arguments are both inside the parentheses like in LISP. A width in bits can be appended to any constant, variable, or operator name and is a positive number inside square brackets. Inline comments are enclosed in angle brackets (less than and greater than signs) and can be nested. Backslashes are used to escape parentheses, square brackets, and angle brackets to remove their special meaning. The normal C/C++ backslash escapes are also understood.

Definition at line 23 of file BinarySymbolicExprParser.h.

#include <BinarySymbolicExprParser.h>

Classes

class  AtomExpansion
 Virtual base class for expanding atoms. More...
 
class  Expansion
 Virtual base class for atom and operator expansion. More...
 
class  OperatorExpansion
 Virtual base class for expanding operators. More...
 
class  SyntaxError
 Syntax errors that are thrown. More...
 
class  Token
 Tokens generated by the lexical analysis. More...
 
class  TokenStream
 A stream of tokens. More...
 

Public Types

typedef std::vector< AtomExpansion::PtrAtomTable
 Ordered atom table. More...
 
typedef std::vector< OperatorExpansion::PtrOperatorTable
 Ordered operator table. More...
 

Public Member Functions

 SymbolicExprParser ()
 Default constructor. More...
 
 SymbolicExprParser (const SmtSolverPtr &solver)
 Parser using a specific SMT solver for simplifications. More...
 
SymbolicExpr::Ptr parse (const std::string &, const std::string &inputName="string")
 Create a symbolic expression by parsing a string. More...
 
SymbolicExpr::Ptr parse (std::istream &input, const std::string &filename, unsigned lineNumber=1, unsigned columnNumber=0)
 Create a symbolic expression by parsing a file. More...
 
SymbolicExpr::Ptr parse (TokenStream &)
 Create a symbolic expression by parsing a token stream. More...
 
void appendAtomExpansion (const AtomExpansion::Ptr &)
 Append a new functor for expanding atoms into symbolic expressions. More...
 
void appendOperatorExpansion (const OperatorExpansion::Ptr &)
 Append a new functor for expanding operators into symbolic expressions. More...
 
std::string docString () const
 Documentation string. More...
 
const AtomTableatomTable () const
 Return all atom expansion functors.
 
AtomTableatomTable ()
 Return all atom expansion functors.
 
const OperatorTableoperatorTable () const
 Return all operator expansion functors.
 
OperatorTableoperatorTable ()
 Return all operator expansion functors.
 

Member Typedef Documentation

Ordered atom table.

Definition at line 251 of file BinarySymbolicExprParser.h.

Ordered operator table.

Definition at line 254 of file BinarySymbolicExprParser.h.

Constructor & Destructor Documentation

Rose::BinaryAnalysis::SymbolicExprParser::SymbolicExprParser ( )

Default constructor.

Rose::BinaryAnalysis::SymbolicExprParser::SymbolicExprParser ( const SmtSolverPtr solver)
explicit

Parser using a specific SMT solver for simplifications.

The solver may be null in which case ROSE's default simplifications are the only ones used.

Member Function Documentation

SymbolicExpr::Ptr Rose::BinaryAnalysis::SymbolicExprParser::parse ( const std::string &  ,
const std::string &  inputName = "string" 
)

Create a symbolic expression by parsing a string.

Parses the string and returns the first expression in the string. Throws a SyntaxError if problems are encountered.

SymbolicExpr::Ptr Rose::BinaryAnalysis::SymbolicExprParser::parse ( std::istream &  input,
const std::string &  filename,
unsigned  lineNumber = 1,
unsigned  columnNumber = 0 
)

Create a symbolic expression by parsing a file.

Parses the file and returns the first expression in the file. Throws a SyntaxError if problems are encountered.

SymbolicExpr::Ptr Rose::BinaryAnalysis::SymbolicExprParser::parse ( TokenStream )

Create a symbolic expression by parsing a token stream.

Parses the token stream and returns its first expression. Throws a SyntaxError if problems are encountered.

void Rose::BinaryAnalysis::SymbolicExprParser::appendAtomExpansion ( const AtomExpansion::Ptr )

Append a new functor for expanding atoms into symbolic expressions.

void Rose::BinaryAnalysis::SymbolicExprParser::appendOperatorExpansion ( const OperatorExpansion::Ptr )

Append a new functor for expanding operators into symbolic expressions.

std::string Rose::BinaryAnalysis::SymbolicExprParser::docString ( ) const

Documentation string.

Returns the documentation string for this parser. The documentation string is a a simple markup language that can be used by command-line parsers.


The documentation for this class was generated from the following file: