NiwenParser

class NiwenParser<T>(types: List<DescribedType<*>>, rootType: ParserNodeDeclaration<T>)

Class for a full parser that is ready to parse a chain of tokens.

Parameters

T

The type of the root node, the node at the root of the resulting model.

types

List of described types that will be used for the parsing process. Each entry describes a type of node that can be encountered in the AST.

rootType

The expected type of the root node.

Constructors

Link copied to clipboard
constructor(types: List<DescribedType<*>>, rootType: ParserNodeDeclaration<T>)

Types

Link copied to clipboard
sealed class ParserResult<T>

Result of a parsing pass

Functions

Link copied to clipboard
fun parse(tokens: List<Token>): T

Launch the parser on the given tokens.

Link copied to clipboard
fun parseToResult(tokens: List<Token>, enableDebugger: Boolean): NiwenParser.ParserResult<T>

Parse this token list to a ParserResult. Whether debugging is enabled or not is controlled by the enableDebugger parameter.

Link copied to clipboard

Parse a list of token using this debugger.