class Parser
Defined in:
parser.crInstance Method Summary
-
#accept(type : TokenType)
Check if the current token matches the given type and return truthy if it does.
-
#advance
Advance through the token stream until a significant token is encountered.
-
#expect(type : TokenType)
Similar to
#accept
, but raise an error if the type does not match. -
#instructions : Array(Instruction)
The list of instructions parsed from the source code.
-
#instructions=(instructions : Array(Instruction))
The list of instructions parsed from the source code.
- #parse_assignment
- #parse_expr
- #parse_factor
- #parse_program
- #parse_statement
- #parse_term
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
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.
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.
Similar to #accept
, but raise an error if the type does not match.
The list of instructions parsed from the source code. This is what will be fed to the interpreter.
The list of instructions parsed from the source code. This is what will be fed to the interpreter.