/usr/share/perl5/Pegex/Overview.pod is in libpegex-perl 0.64-1.
This file is owned by root:root, with mode 0o644.
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 | =pod
=for comment
DO NOT EDIT. This Pod was generated by Swim v0.1.45.
See http://github.com/ingydotnet/swim-pm#readme
=encoding utf8
=head1 What is Pegex?
Pegex is a Friendly, Acmeist, PEG Parser framework. Friendly means that it is
simple to create, understand, modify and maintain Pegex parsers. Acmeist means
that the parsers will work automatically in many programming languages (as
long as they have some kind of traditional "regex" support). PEG (Parser
Expression Grammars) is the new style of Recursive-Descent/BNF style grammar
definition syntax.
The name "Pegex" comes from PEG + Regex. With Pegex you define top down
grammars that eventually break down to regex fragments. ie The low level
parsing matches are always done with regexes against the current position in
the input stream.
=head1 What is Parsing?
It may seem like a silly question, but it's important to have an understanding
of what parsing is and what a parser can do for you. At the the most basic
level "parsing" is the act of reading through an input, making sense of it,
and possibly doing something with what is found.
Usually a parser gets its instructions of what means what from something
called a grammar. A grammar is a set of rules that defines how the input must
be structured. In many parsing methodologies, input is preprocessed (possibly
into tokesn) before the parser/grammar get to look at it. Although this is a
common method, it is not the only approach.
=head1 How Pegex Works
Pegex parsing consists of 4 distinct parts or objects:
=over
=item Parser
The Pegex parsing engine
=item Grammar
The rules of a particular syntax
=item Receiver
The logic for processing matches
=item Input
Text conforming to the grammar rules
=back
Quite simply, a parser object is created with a grammar object and a receiver
object. Then the parser object's C<parse()> method is called on an input
object. The parser applies the rules of the grammar to the input and invokes
methods of the receiver as the rules match. The parse is either successful or
results in an error. The result is whatever the receiver object decides it
should be.
For example consider a parser that turns the Markdown text language into HTML.
The Pegex code to use this might look like this:
In the simplest terms, Pegex works like this (pseudocode):
parser = new Pegex.Parser(
grammar: new Markdown.Grammar
receiver: new Markdown.Receiver.HTML
)
html = parser.parse(markdown)
=head1 See Also
=over
=item * L<Pegex::API>
=item * L<Pegex::Syntax>
=item * L<Pegex::Tutorial>
=back
=cut
|