21 Commits

Author SHA1 Message Date
Aina Niemetz
0647c4c107 Update copyright headers. (#11561)
Co-authored-by: Daniel Larraz <daniel-larraz@users.noreply.github.com>
2025-01-23 17:54:20 +00:00
Aina Niemetz
addb36365d c api: Add API test ouroborous. (#11101) 2024-07-31 05:46:15 +00:00
Aina Niemetz
00d912f521 parser: Refactor symbol manager to be associated to term manager. (#10939) 2024-06-18 23:21:47 +00:00
Aina Niemetz
fdf9ce7138 Update copyright headers. (#10459) 2024-03-12 09:35:09 -07:00
Aina Niemetz
58d7c6d556 c++ api: Expose TermManager to the API. (#10426)
This introduces a TermManager object, which will, in the future, be the
sole object responsible for handling/managing terms and sorts. For now,
all corresponding functions in `cvc5::Solver` are marked as deprecated,
as is constructor `cvc5::Solver::Solver()`, since in the future a solver
instance must be constructed from a term manager instance. Currently, we
maintain a static thread_local term manager instance to not break the
API and continue providing constructor `cvc5::Solver::Solver()`.

Note that this already converts all C++ unit tests to use the
TermManager except for a single test `getStatistics()` in
`test/unit/api/cpp/solver_black.cpp`. Statistics handling is currently
still maintained on the solver level. The statistics we maintain,
however, concern terms only and will eventually be refactored to be
tracked in the NodeManager.

Further note that the Java and Python APIs will be refactored in
separate PRs.
2024-03-08 19:39:13 +00:00
mudathirmahgoub
115d3d200b Add parser to the java api (#10088) 2023-11-28 11:53:30 -06:00
Andrew Reynolds
74443f10ab Adding API checks, unit tests, and examples for the parser API (#10048)
This PR adds the proper checks for the parser API. It furthermore adds examples and unit tests for the parser API.

Note that InputParser::nextCommand and InputParser::nextTerm don't catch exceptions, since we want to throw ParserExceptions containing the parsing information, not API exceptions.

Also, at the moment, the InputParser can throw an exception during initialization, which is not caught either.
2023-10-02 15:51:32 +00:00
Andrew Reynolds
076b556b75 Merge parser API includes to cvc5_parser.h (#9967) 2023-08-29 19:31:05 -05:00
Andrew Reynolds
de944c0db5 Further preparation for parser API (#9955)
Removes an include and sketches the necessary documentation.
2023-08-21 17:40:47 +00:00
Andrew Reynolds
9193bc044f Make symbol manager's interface private (#9946)
This is another step towards the parser API.

It hides the symbol manager's interface entirely. The old implementation is now contained via a new class SymManager.

The last step will be to move this (+ command.h, input_parser.h) from parser/api/cpp/ to include/cvc5/.
2023-08-14 17:39:06 +00:00
Andrew Reynolds
0da85f100e Update unit tests involving ANTLR (#9839)
Furthermore removes parser_builder_black as this utility is no longer needed.

Also corrects a bug in numeral parsing when in strict mode.
2023-06-28 11:53:23 -05:00
Aina Niemetz
0a8baa0f0a Update copyright headers. (#9736) 2023-05-09 18:06:18 +00:00
Mathias Preiner
56e14c4639 Move public headers into top-level include directory. (#9555)
This PR moves the public API headers into a top-level include directory. This makes it easier to find the public API of cvc5 and makes the install headers script obsolete.

Fixes #9553
Fixes #9556
2023-03-07 23:39:29 +00:00
Andrew Reynolds
f4176a5d4f Proper memory management of parsed commands (#9511) 2023-03-07 17:40:06 +00:00
Andrew Reynolds
eabeb34e89 Bind declarations and definitions only when commands are invoked (#9355)
This corrects issues in our parser related to when symbols should be added to our symbol table.

In particular, symbols should be bound only when commands are executed and not as they are parsed. Binding during parsing leads to errors in interactive mode where those symbols are bound more than once, say if a command is partially parsed and then re-parsed based on our line buffering. This required further modifications to the interactive shell to execute commands immediately as they are parsed, since executing them may impact parsing (say if a declare-fun was on the same line as the subsequent command).

This adds new methods for accessing the binding methods of the underlying symbol table of symbol manager.

There are further issues of this form to correct, e.g. for define-fun-rec, which will be addressed in a separate PR.
2023-01-05 21:12:37 +00:00
Andrew Reynolds
ee97e826a5 Decouple parser state from ANTLR specific parsing (#9312)
This renames Smt2 and Tptp to Smt2State and TptpState, and decouples their implementation from ANTLR specific parsing. The Smt2State will be reused in the new flex parser.

It introduces ANTLR-specific wrappers of these classes (called by their previous names Smt2 and Tptp to avoid propagating further name changes), having the same functionality for parsing.

Followup PRs will clean Smt2State / TptpState and move them to smt2_state.h / tptp_state.h.
2022-12-13 17:25:32 -06:00
Andres Noetzli
66d374cd5c Move Command infrastructure to parser (#8893)
This commit moves the `Command` infrastructure to the parser (to
`src/parser/api/cpp`) and moves it to the `cvc5::parser` namespace. The
`Command`-related files are compiled with `-D__BUILDING_CVC5LIB`,
because they need access to the internal printers. The commit refactors
the internal code to not depend on `Command` anymore. To do this, the
commit refactors printing derived classes of `CommandStatus` to follow a
similar structure to printing commands (so that we can also print
command statuses internally without creating instances of
`Commandstatus`). This is a step towards a parser API.
2022-09-16 18:57:55 -07:00
Mathias Preiner
d01e59c13b Update copyright headers for release 1.0 (#8539) 2022-04-05 20:38:57 +00:00
Mathias Preiner
bbcd471ed4 Introduce internal namespace and remove api namespace. (#8443)
The public cvc5 API now lives in the cvc5 namespace. All internal parts were moved into the (new) internal namespace.
The final hierarchy will be as follows:

cvc5
  ~~ public API
  ::context
  ::internal
  ::parser
  ::main

After this PR it will be:

cvc5
  ~~ public API
  ::internal
      ::context
      ::main
  ::parser
2022-03-29 23:23:01 +00:00
Gereon Kremer
561b989855 Refactor IO stream manipulators (#7555)
This PR consolidates SetLanguage, ExprSetDepth and ExprDag into a single consistent utility. Also, it makes it play more nicely with users setting these options and removes some obsolete code.
2021-11-22 22:31:31 +00:00
yoni206
40272d5f3a Translating API tests to Python — part 1 (#7597)
This PR translates some of the API tests from here to Python. The other tests are translated in a private branch and will be added in a separate PR.
2021-11-16 18:56:37 +00:00