class BowlingScorer::Parser

Overview

LL(K) Parser where our K is 3. Our lookahead is three because of a strike is calculated differently when you have three in a row. Our parser is reading tokens off our lexer and building a list of frames. The resulted list repesents a complete game with each frame having the correct score for that frame.

Defined in:

bowling-scorer/parser.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(lexer : BowlingScorer::Lexer = lexer, lookahead : Int32 = 3) #

[View source]

Instance Method Detail

def current_frame : Frame #

[View source]
def current_frame=(current_frame : Frame) #

[View source]
def frame : Int32 #

[View source]
def frame=(frame : Int32) #

[View source]
def frames : Array(Frame) #

[View source]
def index : Int32 #

[View source]
def index=(index : Int32) #

[View source]
def lexer : Lexer #

[View source]
def lookahead : Int32 #

[View source]
def parse : Void #

Public API


[View source]
def score : Int32 #

[View source]
def score=(score : Int32) #

[View source]
def tokens : Array(Token) #

[View source]