Class Parser

java.lang.Object
tech.ixor.calclox.Parser

public class Parser extends Object
Builds CalcLox statements and expressions from a token stream.

Expressions are parsed according to CalcLox precedence rules, from assignment through logical, equality, comparison, arithmetic, unary, and call expressions. Loop syntax is lowered to block and while statements before interpretation.

  • Constructor Details

  • Method Details

    • parse

      public List<Statement> parse()
      Parses all declarations and statements up to the EOF token.
      Returns:
      statements in execution order
      Throws:
      CalcLoxRunnerError - if the token stream does not form a valid program