Class: Kumi::Parser::Parser
- Inherits:
-
Object
- Object
- Kumi::Parser::Parser
- Defined in:
- lib/kumi/parser/parser.rb
Overview
Recursive-descent parser for declarations and a Pratt parser for expressions, producing kumi-core’s Kumi::Syntax::* AST directly.
The parser is the boundary of the parse phase: it reports shape errors (a missing ‘end`, an unexpected token, a malformed hash pair) with exact locations, and it does not attempt to resolve names, check types, or know anything about axes — those are semantic concerns owned by the analyzer.
Instance Method Summary collapse
-
#initialize(tokens, source) ⇒ Parser
constructor
A new instance of Parser.
- #parse ⇒ Object
Constructor Details
#initialize(tokens, source) ⇒ Parser
Returns a new instance of Parser.
15 16 17 18 19 20 |
# File 'lib/kumi/parser/parser.rb', line 15 def initialize(tokens, source) @tokens = tokens @source = source @pos = 0 @imported_names = Set.new end |