InputParser

This class is the main interface for retrieving commands and expressions from an input.


class cvc5.InputParser

This class is the main interface for retrieving commands and expressions from an input using a parser.

After construction, it is expected that an input is first set via e.g. setFileInput(), setStringInput(), or setIncrementalStringInput() and appendIncrementalStringInput(). Then, the methods nextCommand() and nextExpression() can be invoked to parse the input.

The input parser interacts with a symbol manager, which determines which symbols are defined in the current context, based on the background logic and user-defined symbols. If no symbol manager is provided, then the input parser will construct (an initially empty) one.

If provided, the symbol manager must have a logic that is compatible with the provided solver. That is, if both the solver and symbol manager have their logics set (SymbolManager.isLogicSet() and Solver.isLogicSet()), then their logics must be the same.

Upon setting an input source, if either the solver (resp. symbol manager) has its logic set, then the symbol manager (resp. solver) is set to use that logic, if its logic is not already set.

Wrapper class for the C++ class cvc5::parser::InputParser.

appendIncrementalStringInput()

Append string to the input being parsed by this parser. Should be called after calling setIncrementalStringInput.

Parameters:

input – The input string.

done()

Is this parser done reading input?

getSolver()
Returns:

The underlying solver of this input parser.

getSymbolManager()
Returns:

The underlying symbol manager of this input parser.

nextCommand()

Parse and return the next command. Will initialize the logic to “ALL” or the forced logic if no logic is set prior to this point and a command is read that requires initializing the logic.

Returns:

The parsed command. This is the null command if no command was read.

nextTerm()

Parse and return the next term. Requires setting the logic prior to this point.

setFileInput()

Set the input for the given file.

Parameters:
  • lang – The input language (e.g. InputLanguage.SMT_LIB_2_6).

  • filename – The input filename.

setIncrementalStringInput()

Set that we will be feeding strings to this parser via appendIncrementalStringInput

Parameters:
  • lang – The input language (e.g. InputLanguage.SMT_LIB_2_6).

  • name – The name of the stream, for use in error messages.

setStringInput()

Set the input to the given concrete string

Parameters:
  • lang – The input language (e.g. InputLanguage.SMT_LIB_2_6).

  • input – The input string.

  • name – The name of the stream, for use in error messages.