Class Tokenizer
This is not a full SMTLIB parser, but only provides basic support for SMTLIB commands.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringVariable names (symbols) can be wrapped with "|".static booleanisAssertToken(String token) Check if the token is an(assert ...).static booleanisDeclarationToken(String token) Check if the token is a function or variable declaration.static booleanisDefinitionToken(String token) Check if the token is a function definition.static booleanisExitToken(String token) Check if the token is(exit).static booleanisForbiddenToken(String token) Check if this is a forbidden token.static booleanisPopToken(String token) Check if the token is an(pop ...).static booleanisPushToken(String token) Check if the token is an(push ...).static booleanisResetAssertionsToken(String token) Check if the token is an(reset-assertions ...).static booleanisResetToken(String token) Check if the token is an(reset).static booleanisSetLogicToken(String token) Check if the token is(set-logic ..).Split up a sequence of lisp expressions.
-
Method Details
-
dequote
Variable names (symbols) can be wrapped with "|". This function removes those chars. -
tokenize
Split up a sequence of lisp expressions.This is used by
FormulaManager.parse(String)as part of the preprocessing before the input is passed on to the solver. SMT-LIB2 scripts are sequences of commands that are just r-expression. We split them up and then return the list.As an example
tokenize("(define-const a Int)(assert (= a 0)")will return the sequence["(define-const a Int)", "(assert (= a 0))"] -
isSetLogicToken
Check if the token is(set-logic ..).Use
tokenize(String)to turn an SMT-LIB2 script into a string of input tokens. -
isDeclarationToken
Check if the token is a function or variable declaration.Use
tokenize(String)to turn an SMT-LIB2 script into a string of input tokens. -
isDefinitionToken
Check if the token is a function definition.Use
tokenize(String)to turn an SMT-LIB2 script into a string of input tokens. -
isAssertToken
Check if the token is an(assert ...).Use
tokenize(String)to turn an SMT-LIB2 script into a string of input tokens. -
isPushToken
Check if the token is an(push ...).Use
tokenize(String)to turn an SMT-LIB2 script into a string of input tokens. -
isPopToken
Check if the token is an(pop ...).Use
tokenize(String)to turn an SMT-LIB2 script into a string of input tokens. -
isResetAssertionsToken
Check if the token is an(reset-assertions ...).Use
tokenize(String)to turn an SMT-LIB2 script into a string of input tokens. -
isResetToken
Check if the token is an(reset).Use
tokenize(String)to turn an SMT-LIB2 script into a string of input tokens. -
isExitToken
Check if the token is(exit).Use
tokenize(String)to turn an SMT-LIB2 script into a string of input tokens. -
isForbiddenToken
Check if this is a forbidden token.The list of forbidden tokens contains:
- push
- pop
- reset-assertions
- reset
Forbidden tokens manipulate the stack and are not supported while parsing SMT-lIB2 string. When a forbidden token is found parsing should be aborted by throwing an
IllegalArgumentExceptionexception.Use
tokenize(String)to turn an SMT-LIB2 script into a string of input tokens.
-