alpag.net manual
Parser / Parser operation / Automaton
< Context Free Grammar | Basic parsing >

Automaton

Parser operation is based on automaton, which contains states corresponding to different places in grammar. Transitions between states are triggered by input terminal symbols.

Automaton is using additional data structure, a stack, which keeps trace of most recently processed symbols and visited states. When parser recognizes several consecutive input symbols as a production for some nonterminal, it removes them from stack and sets automaton to state corresponding to end of this nonterminal in some high-level grammar construct.

Parser during its operation performs two kinds of actions:

Each automaton state has an action table which tells what to do depending on next symbol read. Possible entries in that table are:

Examples given in further chapters illustrate basic parser operation scenarios.

< Context Free Grammar | Basic parsing >
Alpag Manual