my @terminal_strings = $self->terminals(@terminals)

Returns the strings correscponding to the given terminal symbols. E.g., $self->terminals('octothorpe') returns #.

my ($new_commands, $unknown) = $parser->parse($definition)

$new_commands is a hash that you can use to teach the robot:

  $robot->_learn($_, $new_commands->{$_}, $definition) for keys %$new_commands;

$unknwon is a hash whose keys are all the non-basic commands needed to run the parsed programs.

When the input starts with run , it should contain just one command. The robot's run function uses it to parse commands you run, as simple [[ 'c', $command ]] doesn't work for core commands (left, forward, etc.).

If there's an error, an exception is thrown. It's a hash ref with the following keys:


expected: lists the available terminals. There are several special values: space (white space), alpha (letter starting a word), lf newline, non_lf (anything but a newline), valid_name (character that can occur in a command name starting from the 2nd position: a letter, digit, underscore, or a dash), quote (single quote), non_zero (1-9).


last_completed: the last successfully parsed command.


pos: position (line, column) where the parsing stopped.