openSession

abstract fun openSession(input: LexedSource, initialOperators: OperatorTable = OperatorTables.empty()): PrologParseSession

Opens a clause-by-clause session whose operator table may change between calls.

initialOperators is copied, so later changes to it do not affect the session.


abstract fun openSession(input: SuspendingTextChunkSource, sourceId: String? = null, initialOperators: OperatorTable = OperatorTables.empty(), maximumRetainedTokens: Int? = null): SuspendingPrologParseSession

Opens a clause-by-clause session over asynchronously supplied text chunks.

val session = parser.openSession(chunks, sourceId = "program.pl", maximumRetainedTokens = 4096)
try {
while (!session.isAtEnd) consume(session.parseNextClause() ?: break)
} finally {
session.close()
}

Throws