NAME

VM::Dreamer::Validate - Quality In / Quality Out

SYNOPSIS

validate_definition( $machine_definition );

DESCRIPTION

These functions help make sure that what comes in is what is expected.

validate_definition

Validates the machine's definition. Returns 1 if the definition is value. Otherwise it raises an exception.

build_valid_line_regex

Takes the machine's greatest digit, operand_width and instruction_width and returns a regex corresponding to a valid line in an input file to your machine.

my $machine = { meta => { greatest => { digit => 9, }, }, width => { operand => 2, instruction => 3, }, }; my $valid_line = build_valid_line_regex($machine); # qr/^[0-9]{2}\t[0-9]{3}$/

my $machine = { meta => { greatest => { digit => 8, }, }, width => { operand => 6, instruction => 8, }, }; my $valid_line = build_valid_line_regex($machine); # qr/^[0-7]{6}\t[0-7]{8}$/

get_valid_input_regex

my $machine = { meta => { greatest => { digit => 1, }, }, width => { instruction => 16, }, }; my $valid_input = get_valid_input_regex($machine); # qr/^[0-1]{16}$/

AUTHOR

William Stevenson <william at coders dot coop>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2013 by William Stevenson.

This is free software, licensed under:

 The Artistic License 2.0 (GPL Compatible)