/usr/share/doc/libgraphviz-perl/examples/recdescent.pl is in libgraphviz-perl 2.04-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | #!/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:
ReferenceQualifier Ingredient
| Reference
Reference:
'they'
| 'it'
| 'them'
Ingredient:
'potatoes'
| 'lard'
| 'olive oil'
| 'sugar'
| 'bacon fat'
| 'butter'
| 'salt'
| 'vinegar'
IngredientQualifier:
Amount
| Number
| 'a'
| 'some'
| 'large'
| 'small'
Amount: Number QuantityUnit
ReferenceQualifier:
'the'
| 'those'
| 'each'
| 'half the'
Number:
/[1-9][0-9]*/
| /one|two|three|four|five|six|seven|eight|nine/
| 'a dozen'
Adjective:
'soft'
| 'tender'
| 'done'
| 'charred'
| 'grey'
};
my $graph = GraphViz::Parse::RecDescent->new($recipegrammar);
$graph->as_png("recdescent.png");
|