Package beaver

Class Parser.Simulator

  • Enclosing class:
    Parser

    public class Parser.Simulator
    extends Object
    Simulator is a stripped (of action code) version of a parser that will try to parse ahead token stream after a syntax error. The simulation is considered successful if 3 tokens were shifted successfully. If during simulation this parser encounters an error it drops the first token it tried to use and restarts the simulated parsing.

    Note: Without a special "error" rule present in a grammar, which a parser will try to shift at the beginning of an error recovery, simulation continues without removing anything from the original states stack. This often will lead to cases when no parsing ahead will recover the parser from a syntax error.