• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

example/H13-Feb-2020-309248

inc/H03-May-2022-1,9381,699

lib/H13-Feb-2020-5,7184,369

share/H13-Feb-2020-249196

t/H13-Feb-2020-3,8252,973

xt/H13-Feb-2020-8,1966,948

CONTRIBUTINGH A D13-Feb-20201.2 KiB6132

ChangesH A D13-Feb-20206.6 KiB248182

LICENSEH A D13-Feb-202017.9 KiB380292

MANIFESTH A D13-Feb-20202.4 KiB118117

META.jsonH A D13-Feb-20201.7 KiB7270

META.ymlH A D13-Feb-2020932 4039

Makefile.PLH A D13-Feb-20202.4 KiB11090

READMEH A D13-Feb-20203.7 KiB13493

README

1NAME
2
3    Pegex - Acmeist PEG Parser Framework
4
5VERSION
6
7    This document describes Pegex version 0.75.
8
9SYNOPSIS
10
11        use Pegex;
12        my $result = pegex($grammar)->parse($input);
13
14    or with options:
15
16        use Pegex;
17        use ReceiverClass;
18        my $parser = pegex($grammar, 'ReceiverClass');
19        my $result = $parser->parse($input);
20
21    or more explicitly:
22
23        use Pegex::Parser;
24        use Pegex::Grammar;
25        my $pegex_grammar = Pegex::Grammar->new(
26            text => $grammar,
27        );
28        my $parser = Pegex::Parser->new(
29            grammar => $pegex_grammar,
30        );
31        my $result = $parser->parse($input);
32
33    or customized explicitly:
34
35        {
36            package MyGrammar;
37            use Pegex::Base;
38            extends 'Pegex::Grammar';
39            has text => "your grammar definition text goes here";
40            has receiver => "MyReceiver";
41        }
42        {
43            package MyReceiver;
44            use base 'Pegex::Receiver';
45            got_some_rule { ... }
46            got_other_rule { ... }
47        }
48        use Pegex::Parser;
49        my $parser = Pegex::Parser->new(
50            grammar => MyGrammar->new,
51            receiver => MyReceiver->new,
52        );
53        $parser->parse($input);
54        my $result = $parser->receiver->data;
55
56DESCRIPTION
57
58    Pegex is an Acmeist parser framework. It allows you to easily create
59    parsers that will work equivalently in lots of programming languages!
60    The inspiration for Pegex comes from the parsing engine upon which the
61    postmodern programming language Perl 6 is based on. Pegex brings this
62    beauty to the other justmodern languages that have a normal regular
63    expression engine available.
64
65    Pegex gets it name by combining Parsing Expression Grammars (PEG), with
66    Regular Expressions (Regex). That's actually what Pegex does.
67
68    PEG is the cool new way to elegantly specify recursive descent
69    grammars. The Perl 6 language is defined in terms of a self modifying
70    PEG language called Perl 6 Rules. Regexes are familiar to programmers
71    of most modern programming languages. Pegex defines a simple PEG
72    syntax, where all the terminals are regexes. This means that Pegex can
73    be quite fast and powerful.
74
75    Pegex attempts to be the simplest way to define new (or old) Domain
76    Specific Languages (DSLs) that need to be used in several programming
77    languages and environments. Things like JSON, YAML, Markdown etc. It
78    also great for writing parsers/compilers that only need to work in one
79    language.
80
81USAGE
82
83    The Pegex.pm module itself (this module) is just a trivial way to use
84    the Pegex framework. It is only intended for the simplest of uses.
85
86    This module exports a single function, pegex, which takes a Pegex
87    grammar string as input. You may also pass a receiver class name after
88    the grammar.
89
90        my $parser = pegex($grammar, 'MyReceiver');
91
92    The pegex function returns a Pegex::Parser object, on which you would
93    typically call the parse() method, which (on success) will return a
94    data structure of the parsed data.
95
96    See Pegex::API for more details.
97
98PEGEX DEBUGGING
99
100    Pegex (Pegex::Parser) has many easy to use methods of debugging. See
101    the "Debugging" section of Pegex::Parser for details.
102
103SEE ALSO
104
105      * Pegex::Overview
106
107      * Pegex::API
108
109      * Pegex::Syntax
110
111      * Pegex::Tutorial
112
113      * Pegex::Resources
114
115      * Pegex::Parser
116
117      * http://github.com/ingydotnet/pegex-pm
118
119      * irc://freenode.net#pegex
120
121AUTHOR
122
123    Ingy döt Net <ingy@cpan.org>
124
125COPYRIGHT AND LICENSE
126
127    Copyright 2010-2020. Ingy döt Net.
128
129    This program is free software; you can redistribute it and/or modify it
130    under the same terms as Perl itself.
131
132    See http://www.perl.com/perl/misc/Artistic.html
133
134