NAME

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

SYNOPSIS

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

DESCRIPTION

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

EXPORTS

By default the z80parser subroutines is exported.

FUNCTIONS

z80parser

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.

parse

$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.

BUGS and FEEDBACK

See CPU::Z80::Assembler.

SEE ALSO

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

AUTHORS, COPYRIGHT and LICENCE

See CPU::Z80::Assembler.