class Parser

Defined in:

parser.cr

Instance Method Summary

Instance methods inherited from class Lexer

advance_token advance_token, current_token : Token current_token, current_token=(current_token : Token) current_token=, pos : Int32 pos, pos=(pos : Int32) pos=, read_token read_token, source : String source, source=(source : String) source=

Constructor methods inherited from class Lexer

new(source : String) new

Instance Method Detail

def accept(type : TokenType) #

Check if the current token matches the given type and return truthy if it does. Additionally, if the type matches, automatically advance to the next significant token.


[View source]
def advance #

Advance through the token stream until a significant token is encountered. This abstraction allows the rest of the parser to quietly ignore whitespace and other insignificant tokens.


[View source]
def expect(type : TokenType) #

Similar to #accept, but raise an error if the type does not match.


[View source]
def instructions : Array(Instruction) #

The list of instructions parsed from the source code. This is what will be fed to the interpreter.


[View source]
def instructions=(instructions : Array(Instruction)) #

The list of instructions parsed from the source code. This is what will be fed to the interpreter.


[View source]
def parse_assignment #

[View source]
def parse_expr #

[View source]
def parse_factor #

[View source]
def parse_program #

[View source]
def parse_statement #

[View source]
def parse_term #

[View source]