Module predictive

Source
Expand description

§Predictive

This parser is going to utilise lookahead to predict the applicable production rule.

One modification will still be made to the grammar: An Expression can be empty. Otherwise the parser would never halt since E is defined as:

E ::= I/I | IE <- there has to always be at least one more character

So E becomes:

E ::= I/E | IE | ε

I/I also became I/E otherwise the parser would stop consuming after I so that nothing further will be processed after a fraction. Yet, All Es coming after the next I can’t be part of the fraction which they are due to this change. This will be corrected in CST to AST conversion though.

Structs§

PredictiveCST

Enums§

Expression
IntermediateExpression
SimpleExpression

Functions§

parse
Parses a stream of tokes according to the grammar.