tiny.smt.smtlib.parse
Defined in smtlib.
Reads SMT-LIB text into terms, one command at a time.
API (10)
Actions
Public operations.
parseScript: Reads the scriptsource, adds its constants, functions and terms toctx, and returns aScriptoverctxwith the script's logic and assertions.
Types and contracts
Public types and contracts.
Error: The error set of the reader's functions: any error.ParseError: The errors the reader returns for unreadable or unsupported text.Parser: The state of one reading: theContextthe terms go into, the text, the position in it, and the constants and functions declared so far.
Namespaces
Public namespaces.
errors: The errors of the SMT-LIB reader.script: Reads the commands of an SMT-LIB script in order and collects its logic and assertions.sort: Reads an SMT-LIB sort, or a parenthesized list of sorts, because every declaration gives the sort of a constant or the argument and result sorts of a function.state: The state one reading of an SMT-LIB text carries from call to call.term: Reads one SMT-LIB term and builds it in aContext.token: Splits SMT-LIB text into parentheses and atoms.
Source
Source: lib/smt/src/smtlib/parse/root.zig
zig
//! Reads SMT-LIB text into terms, one command at a time. A caller needs one call that turns a whole//! script into terms and a list of assertions.//!//! The reader reads tokens with `token`, sorts with `sort`, terms with `term` and commands with//! `script`, all over one parser state (`Parser`) from `state`. It descends one call per//! parenthesis, with no depth bound.const smt = @import("../../root.zig");pub const errors = @import("error.zig");pub const script = @import("script.zig");pub const sort = @import("sort.zig");pub const state = @import("state.zig");pub const term = @import("term.zig");pub const token = @import("token.zig");const smt_term = smt.term;pub const Error = errors.Error;pub const ParseError = errors.ParseError;pub const Parser = state.Parser;/// Reads the script `source`, adds its constants, functions and terms to `ctx`, and returns a/// `Script` over `ctx` with the script's logic and assertions. The caller loads an SMT-LIB script/// with it, then solves the assertions of the returned `Script`. The returned `Script` borrows its/// logic name from `source`, so `source` has to outlive it. The caller owns the `Script` and frees/// it with `Script.deinit` before freeing `ctx`. The logic is `ALL` when the script has no/// `set-logic`. On an error the terms already built stay in `ctx`. Each call starts with no/// declared names, so a second script read into the same `ctx` cannot refer to the constants of the/// first. It returns the `ParseError` tags, the errors of the `Context` builders and/// `error.OutOfMemory`, under the error set `Error`, which is `anyerror`.pub fn parseScript(ctx: *smt_term.Context, source: []const u8) Error!smt_term.Script { var parser = Parser.init(ctx, source); defer parser.deinit(); return try script.parse(&parser);}Source: lib/smt/src/smtlib/root.zig:19
zig
pub const parse = @import("parse/root.zig");Audit
| Definitions | 2 |
|---|---|
| Public names | 3 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |