Debian Codegraph @

pod/Deprecated/Stuifzand.pod

raw
1 # Copyright 2022 Jeffrey Kegler
2 # This file is part of Marpa::R2. Marpa::R2 is free software: you can
3 # redistribute it and/or modify it under the terms of the GNU Lesser
4 # General Public License as published by the Free Software Foundation,
5 # either version 3 of the License, or (at your option) any later version.
6 #
7 # Marpa::R2 is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 # Lesser General Public License for more details.
11 #
12 # You should have received a copy of the GNU Lesser
13 # General Public License along with Marpa::R2. If not, see
14 # http://www.gnu.org/licenses/.
15
16 =head1 Name
17
18 Marpa::R2::Deprecated::Stuifzand - Stuifzand Interface (DEPRECATED)
19
20 =head1 THE STUIFZAND INTERFACE IS DEPRECATED
21
22 The Stuifzand interface (also sometimes called the "BNF interface")
23 is deprecated.
24 PLEASE DO NOT USE IT FOR NEW DEVELOPMENT.
25
26 =head1 Synopsis
27
28 =for Marpa::R2::Display
29 name: Stuifzand Synopsis
30 partial: 1
31 normalize-whitespace: 1
32
33 use Marpa::R2;
34
35 my $grammar = Marpa::R2::Grammar->new(
36 {
37 actions => 'My_Actions',
38 default_action => 'do_first_arg',
39 source => \(<<'END_OF_SOURCE'),
40 :start ::= Script
41 Script ::= Expression+ separator => <op comma> action => do_script
42 Expression ::=
43 Number
44 | (<op lparen>) Expression (<op rparen>) action => do_parens assoc => group
45 || Expression (<op pow>) Expression action => do_pow assoc => right
46 || Expression (<op times>) Expression action => do_multiply
47 | Expression (<op divide>) Expression action => do_divide
48 || Expression (<op add>) Expression action => do_add
49 | Expression (<op subtract>) Expression action => do_subtract
50 END_OF_SOURCE
51 }
52 );
53
54 =for Marpa::R2::Display::End
55
56 =head1 Overview
57
58 This page is the reference for the Marpa's "Stuifzand interface",
59 also called its "BNF interface".
60 Use of the Stuifzand interface is now deprecated,
61 in favor of L<the SLIF
62 interface|Marpa::R2::Scanless>.
63 Almost all of the functionality of
64 the Stuifzand interface can be duplicated
65 in the SLIF interface by switching immediately
66 to external scanning,
67 and never switching back to internal scanning.
68 To switch immediately to external scanning in the SLIF,
69 specify a length of zero for its initial
70 L<C<read()>|Marpa::R2::Scanless::R/"read()">.
71 For more details, see the
72 L<document for the SLIF
73 itself|Marpa::R2::Scanless>.
74
75 =head1 The source string
76
77 Stuifzand interface source strings are specified using the
78 L<the C<source> named argument of Marpa::R2's grammars|Marpa::R2::Deprecated::NAIF::Grammar/"source">.
79 BNF source strings perform the functions of
80 the
81 L<C<rules>|Marpa::R2::Deprecated::NAIF::Grammar/"rules">
82 and the
83 L<C<start>|Marpa::R2::Deprecated::NAIF::Grammar/"start">
84 named arguments of Marpa grammars.
85 When
86 the C<source> named argument is used to specify a grammar,
87 the C<rules> and C<start> named arguments should not be used,
88 and vice versa.
89 The syntax for the Stuifzand interface's source string is the
90 same as
91 L<the syntax for the SLIF
92 DSL|Marpa::R2::Scanless::DSL>,
93 except that features and syntax not relevant to the Stuifzand
94 interface are not supported.
95
96 Everything related to L0 grammars is unsupported.
97 L0 grammars do not exist in the Stuifzand interface.
98 Lexemes, character classes and quoted strings all implicitly
99 require a L0 grammar to exist
100 and therefore, they also are not supported.
101
102 Since the Stuifzand interface does not implement internal
103 scanning,
104 everything to do with internal scanning is unsupported.
105 SLIF parse events are the most visible of these features.
106
107 In most cases,
108 when features have introduced after the SLIF replaced
109 the Stuifzand interface
110 as Marpa's primary interface,
111 those features have been retro-ported
112 if they make sense in the Stuifzand context.
113 However, this will necessarily always be the case in
114 the future.
115
116 Here is a list of some of the unsupported SLIF DSL features,
117
118 =over 4
119
120 =item * Character classes
121
122 These implicitly use the L0 grammar.
123
124 =item * Quoted strings
125
126 These implicitly use the L0 grammar.
127
128 =item * Discard rules
129
130 C<:discard> rules control the behavior of the L0 grammar.
131
132 =item * The lexeme and lexeme default statements
133
134 The C<:lexeme> pseudo-rule and
135 the lexeme default statement define the behavior of
136 lexemes.
137 Lexemes in the SLIF sense
138 do not exist in the Stuifzand interface.
139
140 =item * L0 rules
141
142 Rules with the tilde declarator ("C<~>") defined L0 rules.
143
144 =item * Event declarations
145
146 Parse events exist to trigger returns from the SLIF internal scanning
147 methods.
148
149 =item * The pause adverb
150
151 The pause adverb exists
152 to trigger returns from the SLIF internal scanning
153 methods.
154
155 =item * The priority adverb
156
157 The priority adverb defines lexeme priorities.
158 Lexemes in the SLIF sense
159 do not exist in the Stuifzand interface.
160
161 =item * Actions specified as array descriptors
162
163 Actions specified as array descriptors, for example,
164
165 =for Marpa::R2::Display
166 ignore: 1
167
168 action => [start,length,value]
169
170 =for Marpa::R2::Display::End
171
172 exist primarily to support lexeme semantics.
173 They can also specify rule semantics,
174 but their functionality has not been retro-ported
175 to the Stuifzand interface,
176 and probably never will be.
177
178 =back
179
180 =head1 Copyright and License
181
182 =for Marpa::R2::Display
183 ignore: 1
184
185 Copyright 2022 Jeffrey Kegler
186 This file is part of Marpa::R2. Marpa::R2 is free software: you can
187 redistribute it and/or modify it under the terms of the GNU Lesser
188 General Public License as published by the Free Software Foundation,
189 either version 3 of the License, or (at your option) any later version.
190
191 Marpa::R2 is distributed in the hope that it will be useful,
192 but WITHOUT ANY WARRANTY; without even the implied warranty of
193 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
194 Lesser General Public License for more details.
195
196 You should have received a copy of the GNU Lesser
197 General Public License along with Marpa::R2. If not, see
198 http://www.gnu.org/licenses/.
199
200 =for Marpa::R2::Display::End
201
202 =cut
203
204 # Local Variables:
205 # mode: cperl
206 # cperl-indent-level: 4
207 # fill-column: 100
208 # End:
209 # vim: expandtab shiftwidth=4:
210