Karel::Parser
Returns the strings correscponding to the given terminal symbols. E.g., $self->terminals('octothorpe') returns #.
$self->terminals('octothorpe')
#
$new_commands is a hash that you can use to teach the robot:
$new_commands
$robot->_learn($_, $new_commands->{$_}) for keys %$new_commands;
$unknwon is a hash whose keys are all the non-basic commands needed to run the parsed programs.
$unknwon
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.).
run
[[ 'c', $command ]]
left
forward
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).
space
alpha
lf
non_lf
valid_name
quote
non_zero
last_completed: the last successfully parsed command.
pos: position (line, column) where the parsing stopped.
To install Karel, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Karel
CPAN shell
perl -MCPAN -e shell install Karel
For more information on module installation, please visit the detailed CPAN module installation guide.