File: Stuifzand.pod

package info (click to toggle)
libmarpa-r2-perl 12.000000-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,660 kB
  • sloc: perl: 42,628; ansic: 23,387; sh: 4,363; makefile: 157
file content (210 lines) | stat: -rw-r--r-- 6,255 bytes parent folder | download
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# Copyright 2022 Jeffrey Kegler
# This file is part of Marpa::R2.  Marpa::R2 is free software: you can
# redistribute it and/or modify it under the terms of the GNU Lesser
# General Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
#
# Marpa::R2 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser
# General Public License along with Marpa::R2.  If not, see
# http://www.gnu.org/licenses/.

=head1 Name

Marpa::R2::Deprecated::Stuifzand - Stuifzand Interface (DEPRECATED)

=head1 THE STUIFZAND INTERFACE IS DEPRECATED

The Stuifzand interface (also sometimes called the "BNF interface")
is deprecated.
PLEASE DO NOT USE IT FOR NEW DEVELOPMENT.

=head1 Synopsis

=for Marpa::R2::Display
name: Stuifzand Synopsis
partial: 1
normalize-whitespace: 1

    use Marpa::R2;

    my $grammar = Marpa::R2::Grammar->new(
        {   
            actions        => 'My_Actions',
            default_action => 'do_first_arg',
            source          => \(<<'END_OF_SOURCE'),
    :start ::= Script
    Script ::= Expression+ separator => <op comma> action => do_script
    Expression ::=
        Number
        | (<op lparen>) Expression (<op rparen>) action => do_parens assoc => group
       || Expression (<op pow>) Expression action => do_pow assoc => right
       || Expression (<op times>) Expression action => do_multiply
        | Expression (<op divide>) Expression action => do_divide
       || Expression (<op add>) Expression action => do_add
        | Expression (<op subtract>) Expression action => do_subtract
    END_OF_SOURCE
        }
    );

=for Marpa::R2::Display::End

=head1 Overview

This page is the reference for the Marpa's "Stuifzand interface",
also called its "BNF interface".
Use of the Stuifzand interface is now deprecated,
in favor of L<the SLIF
interface|Marpa::R2::Scanless>.
Almost all of the functionality of
the Stuifzand interface can be duplicated
in the SLIF interface by switching immediately
to external scanning,
and never switching back to internal scanning.
To switch immediately to external scanning in the SLIF,
specify a length of zero for its initial
L<C<read()>|Marpa::R2::Scanless::R/"read()">.
For more details, see the
L<document for the SLIF
itself|Marpa::R2::Scanless>.

=head1 The source string

Stuifzand interface  source strings are specified using the 
L<the C<source> named argument of Marpa::R2's grammars|Marpa::R2::Deprecated::NAIF::Grammar/"source">.
BNF source strings perform the functions of
the
L<C<rules>|Marpa::R2::Deprecated::NAIF::Grammar/"rules">
and the
L<C<start>|Marpa::R2::Deprecated::NAIF::Grammar/"start">
named arguments of Marpa grammars.
When
the C<source> named argument is used to specify a grammar,
the C<rules> and C<start> named arguments should not be used,
and vice versa.
The syntax for the Stuifzand interface's source string is the
same as
L<the syntax for the SLIF
DSL|Marpa::R2::Scanless::DSL>,
except that features and syntax not relevant to the Stuifzand
interface are not supported.

Everything related to L0 grammars is unsupported.
L0 grammars do not exist in the Stuifzand interface.
Lexemes, character classes and quoted strings all implicitly
require a L0 grammar to exist
and therefore, they also are not supported.

Since the Stuifzand interface does not implement internal
scanning,
everything to do with internal scanning is unsupported.
SLIF parse events are the most visible of these features.

In most cases,
when features have introduced after the SLIF replaced
the Stuifzand interface
as Marpa's primary interface,
those features have been retro-ported
if they make sense in the Stuifzand context.
However, this will necessarily always be the case in
the future.

Here is a list of some of the unsupported SLIF DSL features,

=over 4

=item * Character classes

These implicitly use the L0 grammar.

=item * Quoted strings

These implicitly use the L0 grammar.

=item * Discard rules

C<:discard> rules control the behavior of the L0 grammar.

=item * The lexeme and lexeme default statements

The C<:lexeme> pseudo-rule and
the lexeme default statement define the behavior of
lexemes.
Lexemes in the SLIF sense
do not exist in the Stuifzand interface.

=item * L0 rules

Rules with the tilde declarator ("C<~>") defined L0 rules.

=item * Event declarations

Parse events exist to trigger returns from the SLIF internal scanning
methods.

=item * The pause adverb

The pause adverb exists
to trigger returns from the SLIF internal scanning
methods.

=item * The priority adverb

The priority adverb defines lexeme priorities.
Lexemes in the SLIF sense
do not exist in the Stuifzand interface.

=item * Actions specified as array descriptors

Actions specified as array descriptors, for example,

=for Marpa::R2::Display
ignore: 1

    action => [start,length,value]

=for Marpa::R2::Display::End

exist primarily to support lexeme semantics.
They can also specify rule semantics,
but their functionality has not been retro-ported
to the Stuifzand interface,
and probably never will be.

=back
   
=head1 Copyright and License

=for Marpa::R2::Display
ignore: 1

  Copyright 2022 Jeffrey Kegler
  This file is part of Marpa::R2.  Marpa::R2 is free software: you can
  redistribute it and/or modify it under the terms of the GNU Lesser
  General Public License as published by the Free Software Foundation,
  either version 3 of the License, or (at your option) any later version.

  Marpa::R2 is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser
  General Public License along with Marpa::R2.  If not, see
  http://www.gnu.org/licenses/.

=for Marpa::R2::Display::End

=cut

# Local Variables:
#   mode: cperl
#   cperl-indent-level: 4
#   fill-column: 100
# End:
# vim: expandtab shiftwidth=4: