|
Clingo
|
A parser for the clingo language. More...
#include <parser.hh>
Public Member Functions | |
| Parser (Logger &log, SymbolStore &store, ProgramBackend *prg_backend=nullptr, TheoryBackend *thy_backend=nullptr) | |
| Construct the parser. | |
| Parser (Parser const &other)=delete | |
| Copy construct the parser. | |
| Parser (Parser &&other) noexcept | |
| Move construct the parser. | |
| auto | operator= (Parser const &other) -> Parser &=delete |
| Copy assign the parser. | |
| auto | operator= (Parser &&other) noexcept -> Parser & |
| Move assign the parser. | |
| ~Parser () noexcept | |
| Destroy the parser. | |
| void | init (std::istream &in, String file) |
| Initialize parser reading from the given input stream. | |
| void | init (std::string_view in, String file) |
| Initialize parser with the given string. | |
| auto | parse_symbol () -> std::optional< SharedSymbol > |
| Parse a symbol. | |
| auto | parse_program_parts () -> std::optional< ProgramParamVec > |
| Parse program params to ground. | |
| auto | parse_const_def () -> std::optional< std::pair< SharedString, SharedSymbol > > |
| Parse a const definition of form name=symbol. | |
| auto | parse_term () -> std::optional< Term > |
| Parse a term. | |
| auto | parse_theory_term () -> std::optional< TheoryTerm > |
| Parse a theory term. | |
| auto | parse_literal () -> std::optional< Lit > |
| Parse a literal. | |
| auto | parse_body_literal () -> std::optional< BdLit > |
| Parse a body literal. | |
| auto | parse_head_literal () -> std::optional< HdLit > |
| Parse a head literal. | |
| auto | parse_statement () -> std::optional< Stm > |
| Parse a statement. | |
| auto | scan () -> std::pair< std::optional< Stm >, bool > |
| Scan statements. | |
A parser for the clingo language.
| CppClingo::Input::Parser::Parser | ( | Logger & | log, |
| SymbolStore & | store, | ||
| ProgramBackend * | prg_backend = nullptr, |
||
| TheoryBackend * | thy_backend = nullptr |
||
| ) |
Construct the parser.
The parser is in an invalid state and must be initialized first.
| void CppClingo::Input::Parser::init | ( | std::string_view | in, |
| String | file | ||
| ) |
Initialize parser with the given string.
Note that the string is copied.
| auto CppClingo::Input::Parser::scan | ( | ) | -> std::pair< std::optional< Stm >, bool > |
Scan statements.
If no statement is returned, the end of input has been reached. The Boolean indicates a parse error. Note that the functions tries to recover from errors and might still be able to continue parsing.