The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Parse::Marpa::MDL -- Utility Methods for MDL

OVERVIEW

These routines handle the conversion of MDL names to plumbing names.

DESCRIPTION

MDL symbol names behave differently from those in the raw interface. MDL symbol names are allowed to vary in capitalization and separation, while in the plumbing, every slight variation of capitalization or separation produces a new, unique name.

MDL symbol names have a "canonical form", which MDL uses with the plumbing. Users should always use the Parse::Marpa::MDL::canonical_name method to convert from the MDL symbol name to its canonical form.

METHODS

canonical_name

    $g->set({
        start => Parse::Marpa::MDL::canonical_symbol_name("Grammar")
    });

Takes as its one argument an MDL symbol name and returns the canonical MDL name, which is also the symbol's raw interface name.

Canonical MDL names are all lowercase, with hyphens for separation. For example, the MDL symbol whose acceptable variants include My symbol and MY_SYMBOL is, in canonical form, my-symbol.

get_symbol

    my $op = Parse::Marpa::MDL::get_symbol($g, "Op");

Given a Marpa grammar object as the first argument and an MDL symbol name as the second. the get_symbol static method will return the symbol's "cookie". Symbol cookies are needed to use the Parse::Marpa::Recognizer::earleme method.

SUPPORT

See the support section in the main module.

AUTHOR

Jeffrey Kegler

COPYRIGHT

Copyright 2007 - 2008 Jeffrey Kegler

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.