CPAN-IndexPod
view release on metacpan or search on metacpan
t/unpacked/GraphViz/examples/recdescent.pl view on Meta::CPAN
#!/usr/bin/perl -w
use strict;
use lib '../lib';
use GraphViz::Parse::RecDescent;
# The grammar below was taken from the Parse::RecDescent
# demo_recipe.pl script
# "Potato, Egg, Red meat & Lard Cookbook",
# T. Omnicient Rash & N. Hot Ignorant-Kant
# O'Besity & Associates
my $recipegrammar =
q{
Recipe: Step(s)
Step:
Verb Object Clause(s?)
{ print "$item[1]\n" }
| <resync:[ ]{2}>
Verb:
'boil'
| 'peel'
| 'mix'
| 'melt'
| 'fry'
| 'steam'
| 'marinate'
| 'sprinkle'
| 'is'
| 'are'
| 'has'
Object:
IngredientQualifier(s) Ingredient
| ReferenceQualifier(s) Ingredient
| Reference
Clause:
SubordinateClause
| CoordinateClause
SubordinateClause:
'until' State
| 'while' State
| 'for' Time
CoordinateClause:
/and( then)?/ Step
| /or/ Step
State:
Object Verb Adjective
| Adjective
Time:
Number TimeUnit
TimeUnit:
/hours?/
/minutes?/
/seconds?/
QuantityUnit:
/lbs?/
Object:
( run in 1.519 second using v1.01-cache-2.11-cpan-6aa56a78535 )