Parse::Eyapp::TokenGen(3) User Contributed Perl Documentation Parse::Eyapp::TokenGen(3)

Parse::Eyapp::TokenGen - Support for Using Parse::Eyapp as a Data Generator

For a introduction to data generation using Parse::Eyapp see Parse::Eyapp::datagenerationtut.

Receives the parser object and the pairs

    token => generator

Sets the generator attribute of the tokens. Though not strictly necessary, the generator is a Test::LectroTest::Generator object.

Receives the parser object and the pairs

    token => weight

Sets the weight attribute of the tokens. The weight is a floating number.

Receives the parser object and the pairs

    token => [weight, generator]

or

    token => weight

and sets the weight and generator attributes of the tokens. An example can be found in "examples/generator/GenSupport.pm":

  $parser->set_tokenweightsandgenerators(
    NUM => [ 2, Int(range=>[0, 9], sized=>0)],
    VAR => [
              0,  # At the beginning, no variables are defined
              Gen {
                return  Elements(keys %st)->generate if keys %st;
                return Int(range=>[0, 9], sized=>0)->generate;
              },
            ],
    VARDEF => [ 
                2,  
                String( length=>[1,2], charset=>"A-NP-Z", size => 100 )
              ],
    '=' => 2, '-' => 1, '+' => 2, 
    '*' => 4, '/' => 2, '^' => 0.5, 
    ';' => 1, '(' => 1, ')' => 2, 
    ''  => 2, 'error' => 0,
  );

Receives the parser object and the token and returns the weight. If an additional weight is provided the weight for the token is set.

Receives the parser object and the token and returns the generator. If an additional generator is provided the generator for the token is set.

Has the syntax:

  $parser->deltaweight(TOKEN1 => deltaweight1, TOKEN2 => deltaweight2, ...)

increases the weight of the respective token by the associated amount.

As "deltaweight" but the current weights of the involved tokens are saved in a stack

Restores the weights of the tokens that were previously saved with "pushdeltaweight"

  • <http://search.cpan.org/perldoc?yagg::Tutorial>,
  • <http://www.cs.wm.edu/~coppit/wiki/images/4/4e/yagg_short.pdf>,
  • <http://www.cs.wm.edu/~coppit/wiki/images/6/69/wm-cs-2005-13.pdf>

William N. Braswell, Jr. <wbraswell_cpan@NOSPAM.nym.hush.com> (Remove "NOSPAM".)

This work has been supported by CEE (FEDER) and the Spanish Ministry of Educacion y Ciencia through Plan Nacional I+D+I number TIN2005-08818-C04-04 (ULL::OPLINK project <http://www.oplink.ull.es/>). Support from Gobierno de Canarias was through GC02210601 (Grupos Consolidados). The University of La Laguna has also supported my work in many ways and for many years.

A large percentage of code is verbatim taken from Parse::Yapp 1.05. The author of Parse::Yapp is Francois Desarmenien.

I wish to thank Francois Desarmenien for his Parse::Yapp module, to my students at La Laguna and to the Perl Community. Thanks to the people who have contributed to improve the module (see "CONTRIBUTORS" in Parse::Eyapp). Thanks to Larry Wall for giving us Perl. Special thanks to Juana.

Copyright © 2006, 2007, 2008, 2009, 2010, 2011, 2012 Casiano Rodriguez-Leon. Copyright © 2017 William N. Braswell, Jr. All Rights Reserved.

Parse::Yapp is Copyright © 1998, 1999, 2000, 2001, Francois Desarmenien. Parse::Yapp is Copyright © 2017 William N. Braswell, Jr. All Rights Reserved.

These modules are free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Hey! The above document had some coding errors, which are explained below:

Non-ASCII character seen before =encoding in '©'. Assuming UTF-8
2017-06-14 perl v5.34.0