Parser

From Sunhill Framework Documentation

The Sunhill Parser is a simple class based shift-reduce-parser with operator precedence. Primally written for queries, the parse could be adapted for multiple scnearios.

Main classes

The parser subsystem consists of the following components:

Lexer

The lexer splits the input string to single token that the parser can process. There are some predefined lexemes like integer, float or strings and some user defined lexems.

See Lexer.

Parser

The parser translates the input string into an abstract structure tree (AST) that can be further processed be the analyer and/or executor.

See Parser.

Analyzer

The analyzer takes the abstract structure tree and checks it for semantic errors like type mismatches, missing identifiers or missing functions.

See Analyzer.

Executor

The executor takes the abstract syntax tree and performs some kind of action on it to get a result.

See Executor.

Supporting classes

There are some supporting classes:

Token

A token is a single unit that is returned by the lexer and processed by the parser

See Token.

Node

A node is a single element in the abstract structure tree. The root of the abstract structure tree is always a node.

See Node.