This file is indexed.

/usr/share/perl5/Pegex/Miscellany.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
 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
122
123
124
125
126
127
=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 Miscellany

This document contains things about Pegex that were written but seemed out of
place in their original documents. Still they are possibly useful so live
here for now.

=head1 Pegex Overview

In the diagram below, there is a simple language called Foo. The diagram shows
how Pegex can take a text grammar defining Foo and generate a parser that can
parse Foo sources into data (abstract syntax trees).

                              Parsing a language called "Foo"
                                 with the Pegex toolset.

                                .-----------------------.
    .--------------------.      |    Pegex::Compiler    |
    |    Foo Language    |      |-----------------------|    Serialize
    |--------------------|----->| Pegex::Grammar::Pegex |---------.
    | Pegex grammar text |      | Pegex::Receiver       |         |
    '--------------------'      '-----------------------'         v
    ......................                  |                 .------.
    |                    |                  | compile()       | YAML |
    |foo: verb noun      |                  v                 '------'
    |verb: /Hello/       |       .--------------------.       .------.
    |noun: /world/       |       | Foo grammar tree   |       | JSON |
    |                    |       '--------------------'       '------'
    ......................                  |                 .------.
                                            |                 | Perl |
                                            v                 '------'
                                 .---------------------.      .--------.
                                 | Pegex::Grammar::Foo |      | Python |
                                 |---------------------|      '--------'
                                 | Pegex::Parser       |      .-----.
                                 | Pegex::AST::Foo     |      | etc |
     .-----------------.         '---------------------'      '-----'
     |  Foo Language   |                    |
     |-----------------|------------------->| parse()
     | Foo source text |                    v
     '-----------------'        .----------------------.
     ...................        | Parsed Foo Data Tree |
     |Hello world      |        '----------------------'
     ...................        ........................
                                |- verb: Hello         |
                                |- noun: world         |
                                ........................

=head1 FYI

Pegex is self-hosting. This means that the Pegex grammar language
syntax is defined by a Pegex grammar! This is important because (just
like any Pegex based language) it makes it easier to port to new
programming languages. You can find the Pegex grammar for Pegex
grammars here: L<http://github.com/ingydotnet/pegex-pgx/>.

Pegex was originally inspired by Perl 6 Rules. It also takes ideas from Damian
Conway's Perl 5 module, L<Regexp::Grammars>. Pegex tries to take the best
ideas from these great works, and make them work in as many languages as
possible. That's Acmeism.

=head1 Self Compilation Tricks

You can have some fun using Pegex to compile itself. First get the Pegex
grammar repo:

    git clone git://github.com/ingydotnet/pegex-pgx.git
    cd pegex-pgx

Then parse and dump the Pegex grammar with Pegex:

    perl -MXXX -MPegex -e 'XXX pegex("pegex.pgx")->parse("pegex.pgx")'

For a different view of the data tree, try:

    perl -MXXX -MPegex -e 'XXX pegex("pegex.pgx", receiver => "Pegex::Tree")->parse("pegex.pgx")'

Finally to emulate the Pegex compiler do this:

    perl -MXXX -MPegex -e 'XXX pegex("pegex.pgx", receiver => "Pegex::Pegex::AST")->parse("pegex.pgx")'

This specifies a "receiving" class that can shape the results into something
useful. Indeed, this is the exact guts of L<Pegex::Grammar::Pegex>.

=head1 A Real World EXAMPLE

L<TestML> is a new Acmeist unit test language. It is perfect for software that
needs to run equivalently in more than one language. In fact, Pegex itself is
tested with TestML!!

TestML has a language specification grammar:
L<http://www.testml.org/specification/language/>

The Perl6 implementation of TestML uses this grammar in:
L<https://github.com/ingydotnet/testml-pm6/blob/master/lib/TestML/Parser/Grammar.pm>

All other implementations of TestML use this Pegex grammar:
L<https://github.com/ingydotnet/testml-pgx/blob/master/testml.pgx>

In Perl 5, Pegex::Compiler is used to compile the grammar into this simple
data structure (shown in YAML):
L<https://github.com/ingydotnet/testml-pgx/blob/master/testml.pgx.yaml>

The grammar can also be precompiled to JSON:
L<https://github.com/ingydotnet/testml-pgx/blob/master/testml.pgx.json>

Pegex::Compiler further compiles this into a Perl 5 only grammar tree, which
becomes this module:
L<https://github.com/ingydotnet/testml-pm/blob/master/lib/TestML/Grammar.pm>

TestML::Parser::Grammar is a subclass of Pegex::Grammar. It can be used to
parse TestML files. TestML::Parser calls the L<parse()> method of the grammar
with a TestML::AST object that receives callbacks when various rules match,
and uses the information to build a TestML::Document object.

Thus TestML is an Acmeist language written in Pegex. It can be easily ported
to every language where Pegex exists. In fact, it must be ported to those
languages in order to test the new Pegex implementation!

=cut