PrologTermParserVisitor

Converts parser concrete-syntax nodes into tuProlog Terms allocated in scope.

Reusing one visitor for a complete term or clause preserves variable identity within that parse. Theory parsing instead creates a fresh visitor and Scope for each clause, as Prolog variables are local to a clause. Parentheses and source trivia affect the concrete syntax tree but not the resulting domain term.

See also

Constructors

Link copied to clipboard
constructor(scope: Scope)

Properties

Link copied to clipboard

factory and variable-identity context used for all produced terms

Functions

Link copied to clipboard
open fun visit(node: SyntaxNode): Term
Link copied to clipboard
open override fun visitBlock(node: BlockNode): Term

Converts a non-empty brace block to the corresponding tuProlog block term.

Link copied to clipboard
open fun visitClause(node: ClauseNode): Term
Link copied to clipboard
Link copied to clipboard
open override fun visitList(node: ListNode): Term

Converts list items and an optional explicit tail to a tuProlog logic list.

Link copied to clipboard
open override fun visitNumber(node: NumberNode): Term

Converts a numeric node while preserving its sign, radix, and exact digit spelling.

Link copied to clipboard
open override fun visitOperator(node: OperatorExpressionNode): Term

Converts an operator application to a structure named after its resolved operator.

Link copied to clipboard
open override fun visitStructure(node: StructureNode): Term

Converts a structure and recursively converts its arguments.

Link copied to clipboard
open fun visitTerm(node: TermNode): Term
Link copied to clipboard
open override fun visitTheory(node: TheoryNode): Term

Rejects direct theory conversion because this visitor produces one Term at a time.

Link copied to clipboard
open override fun visitVariable(node: VariableNode): Term

Converts named variables through scope and creates a fresh variable for each anonymous use.