140 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
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
Andrew Reynolds
68b300c67d Refactor initialization of logic in parser (#9751)
This is in preparation for new uses of the input parser, e.g. for parsing terms.
This adds the functionality to initialize the logic of the parser without reading commands.
It simplifies the handling of how logics were initialized previously.
2023-05-19 18:22:57 +00: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
Andres Noetzli
55d024acca Move SymbolManager and SymbolTable to parser (#8910)
This moves `SymbolManager` and `SymbolTable` to the parser. To do so, it
modifies headers in the `context` package to be public to the parser
(changes `cvc5_private.h` to `cvc5parser_public.h`), because they are
shared between the parser and the main library.
2022-06-27 22:28:27 +00:00
Mathias Preiner
d01e59c13b Update copyright headers for release 1.0 (#8539) 2022-04-05 20:38:57 +00:00
Andres Noetzli
01061af730 [API] Remove redundant version of mkFunctionSort (#8503)
mkFunctionSort that takes two sorts as arguments is redundant, because
the first argument is equivalent to a vector of size one passed to the
other overload of mkFunctionSort. This commit removes the method from
the C++ API but keeps the existing semantics for the Java and Python
bindings for convenience and consistency with, e.g. mkTerm.
2022-04-01 04:50:25 +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
8f7952bc09 Replace Debug by Trace (#7793)
This PR replaces all usages of Debug() by Trace(), the same for similar methods like Debug.isOn().
Given that Debug is no longer used then, it is removed.
2022-03-17 18:00:56 +00:00
Andres Noetzli
6b459fe916 Remove broken/unused --mmap option (#8178)
Fixes #2705. This commit removes the broken and unused --mmap option.
Given that we are planning to change to a different parser at some
point, it is not worth attempting to fix the option.
2022-02-28 19:21:16 +00:00
Mathias Preiner
e116c00719 Remove CVC language support (#7219)
This commit removes the support for the CVC language and converts all *.cvc regression tests to SMT-LIBv2.
2021-09-22 20:38:46 +00:00
Gereon Kremer
3183ca6685 Handle languages as strings in driver (#7074)
This PR moves the first chunk of code in the driver to use the proper options API for the language options. It is now handled as a string.
2021-08-27 18:23:15 +00:00