
CPU::Z80::Assembler::Parser - Parser for the Z80 assembler

use CPU::Z80::Assembler::Parser; z80parser($input, $program);

This module converts an input stream of tokens returned by the CPU::Z80::Assembler::Lexer to a binary object code that is returned in the passed CPU::Z80::Assembler::Program object.

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 (CPU::Z80::Assembler::Stream), 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 CPU::Z80::Assembler::Token with the token type, the token value and the input source line where the token was read.
The input source line is a CPU::Z80::Assembler::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.

See CPU::Z80::Assembler.

CPU::Z80::Assembler::Lexer CPU::Z80::Assembler::Program

See CPU::Z80::Assembler.