Debian Codegraph @

info/gcl/Splicing-in-Modified-BNF-Syntax.html

raw
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html>
3 <!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6 <title>Splicing in Modified BNF Syntax (ANSI and GNU Common Lisp Document)</title>
7
8 <meta name="description" content="Splicing in Modified BNF Syntax (ANSI and GNU Common Lisp Document)">
9 <meta name="keywords" content="Splicing in Modified BNF Syntax (ANSI and GNU Common Lisp Document)">
10 <meta name="resource-type" content="document">
11 <meta name="distribution" content="global">
12 <meta name="Generator" content="makeinfo">
13 <link href="index.html" rel="start" title="Top">
14 <link href="Notational-Conventions.html" rel="up" title="Notational Conventions">
15 <link href="Indirection-in-Modified-BNF-Syntax.html" rel="next" title="Indirection in Modified BNF Syntax">
16 <link href="Modified-BNF-Syntax.html" rel="prev" title="Modified BNF Syntax">
17 <style type="text/css">
18 <!--
19 a.summary-letter {text-decoration: none}
20 blockquote.indentedblock {margin-right: 0em}
21 div.display {margin-left: 3.2em}
22 div.example {margin-left: 3.2em}
23 div.lisp {margin-left: 3.2em}
24 kbd {font-style: oblique}
25 pre.display {font-family: inherit}
26 pre.format {font-family: inherit}
27 pre.menu-comment {font-family: serif}
28 pre.menu-preformatted {font-family: serif}
29 span.nolinebreak {white-space: nowrap}
30 span.roman {font-family: initial; font-weight: normal}
31 span.sansserif {font-family: sans-serif; font-weight: normal}
32 ul.no-bullet {list-style: none}
33 -->
34 </style>
35
36
37 </head>
38
39 <body lang="en">
40 <span id="Splicing-in-Modified-BNF-Syntax"></span><div class="header">
41 <p>
42 Next: <a href="Indirection-in-Modified-BNF-Syntax.html" accesskey="n" rel="next">Indirection in Modified BNF Syntax</a>, Previous: <a href="Modified-BNF-Syntax.html" accesskey="p" rel="prev">Modified BNF Syntax</a>, Up: <a href="Notational-Conventions.html" accesskey="u" rel="up">Notational Conventions</a> &nbsp; </p>
43 </div>
44 <hr>
45 <span id="Splicing-in-Modified-BNF-Syntax-1"></span><h4 class="subsubsection">1.4.1.3 Splicing in Modified BNF Syntax</h4>
46
47 <p>The primary extension used is the following:
48 </p>
49 <div align="center">[[O]]
50 </div>
51 <p>An expression of this form appears whenever a list of elements is
52 to be spliced into a larger structure and the elements can appear in
53 any order. The symbol O represents a description of the syntax of
54 some number of syntactic elements to be spliced; that description must
55 be of the form
56 </p>
57 <div align="center">O_1 | ... | O_l
58 </div>
59 <p>where each O_i can be of the form S or of
60 the form S<span class="roman">*</span> or of the form S^1.
61 </p>
62 <p>The expression [[O]] means that a list of the form
63 </p>
64 <div align="center">(O_{i_1}... O_{i_j}) 1&lt;= j
65 </div>
66 <p>is spliced into the enclosing expression,
67 such that if n != m and 1&lt;= n,m&lt;= j,
68 then either O_{i_n}!= O_{i_m}
69 or O_{i_n} = O_{i_m} = Q_k,
70 where for some 1&lt;= k &lt;= n, O_k is of the form Q_k<span class="roman">*</span>.
71 </p>
72 <p>Furthermore, for each O_{i_n} that is of the form Q_k^1,
73 that element is required to appear somewhere in the list to be spliced.
74 </p>
75 <p>For example, the expression
76 </p>
77 <p><tt>(x [[A | B<span class="roman">*</span> | C]] y)</tt>
78 </p>
79 <p>means that at most one <tt>A</tt>, any number of <tt>B</tt>&rsquo;s, and
80 at most one <tt>C</tt> can occur in any order.
81 It is a description of any of these:
82 </p>
83 <div class="example">
84 <pre class="example"> (x y)
85 (x B A C y)
86 (x A B B B B B C y)
87 (x C B A B B B y)
88 </pre></div>
89
90 <p>but not any of these:
91 </p>
92 <div class="example">
93 <pre class="example"> (x B B A A C C y)
94 (x C B C y)
95 </pre></div>
96
97 <p>In the first case, both <tt>A</tt> and <tt>C</tt> appear too often,
98 and in the second case <tt>C</tt> appears too often.
99 </p>
100 <p>The notation [[O_1 | O_2 | ...]]^+
101 adds the additional restriction that at least one item from among the possible
102 choices must be used. For example:
103 </p>
104 <p><tt>(x [[A | B<span class="roman">*</span> | C]]^+ y)</tt>
105 </p>
106 <p>means that at most one <tt>A</tt>, any number of <tt>B</tt>&rsquo;s, and
107 at most one <tt>C</tt> can occur in any order, but that in any case at least
108 one of these options must be selected.
109 It is a description of any of these:
110 </p>
111 <div class="example">
112 <pre class="example"> (x B y)
113 (x B A C y)
114 (x A B B B B B C y)
115 (x C B A B B B y)
116 </pre></div>
117
118 <p>but not any of these:
119 </p>
120 <div class="example">
121 <pre class="example"> (x y)
122 (x B B A A C C y)
123 (x C B C y)
124 </pre></div>
125
126 <p>In the first case, no item was used;
127 in the second case, both <tt>A</tt> and <tt>C</tt> appear too often;
128 and in the third case <tt>C</tt> appears too often.
129 </p>
130 <p>Also, the expression:
131 </p>
132 <p><tt>(x [[A^1 | B^1 | C]] y)</tt>
133 </p>
134 <p>can generate exactly these and no others:
135 </p>
136 <div class="example">
137 <pre class="example"> (x A B C y)
138 (x A C B y)
139 (x A B y)
140 (x B A C y)
141 (x B C A y)
142 (x B A y)
143 (x C A B y)
144 (x C B A y)
145 </pre></div>
146
147 <hr>
148 <div class="header">
149 <p>
150 Next: <a href="Indirection-in-Modified-BNF-Syntax.html" accesskey="n" rel="next">Indirection in Modified BNF Syntax</a>, Previous: <a href="Modified-BNF-Syntax.html" accesskey="p" rel="prev">Modified BNF Syntax</a>, Up: <a href="Notational-Conventions.html" accesskey="u" rel="up">Notational Conventions</a> &nbsp; </p>
151 </div>
152
153
154
155 </body>
156 </html>