CPU::Z80::Assembler::Parser - Parser for the Z80 assembler
use CPU::Z80::Assembler::Parser; z80parser($input, $program);
By default the z80parser subroutines is exported.
This function is just a wrapper around the parse function. It takes as parameter a stream of assembly tokens as returned by the lexer and a CPU::Z80::Assembler::Program object to collect the object code.
The assembly program is parsed and loaded into CPU::Z80::Assembler::Program.
$result = parse($input, $user, $start_rule)
This function receives the input token stream (Iterator::Simple::Lookahead), a user pointer and an optional start rule number.
It parses the input stream, leaving the stream at the first unparsed token, and returns the parse value - the result of the action function for the start rule.
The function dies with an error message indicating the input that cannot be parsed in case of a parse error.
$input is a stream of tokens, each token is a Asm::Preproc::Token with the token type, the token value and the input source line where the token was read.
The input source line is a Asm::Preproc::Line with the text of the whole input source line, the line number and the source file name. This is used at error messages.
$user is a user pointer that is passed back at each action function.
$start_rule is an optional alternative start rule ID.