comparison doc/manual/xg-ii.tex @ 0:13d2b8934445

Import AnaGram (near-)release tree into Mercurial.
author David A. Holland
date Sat, 22 Dec 2007 17:52:45 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:13d2b8934445
1 \chapter{Exploring Your Grammar II: Grammar Tables}
2
3 \section{Purpose of This Chapter}
4
5 AnaGram creates a number of tables which are useful for understanding
6 your grammar and verifying its operation. This chapter discusses
7 these tables and what you can learn from them. The discussions are
8 organized around related groups of tables which deal with particular
9 aspects of your grammar. Generally speaking, when you make a new
10 grammar or make extensive revisions of an old one, you should look at
11 some of these tables just to verify that they make sense.
12
13 Many of the tables AnaGram creates are listed in the
14 \index{Browse menu}\index{Menu}\agmenu{Browse} menu of the
15 \agwindow{Control Panel} after you have analyzed your grammar. Other
16 tables, which expand upon the data in a particular window, are
17 available by clicking the right mouse button to pop up the
18 \agmenu{Auxiliary Windows} menu. The tables in this menu expand upon
19 the data under the cursor bar in the window you are examining. If a
20 particular menu item is not available for the selected data, it will
21 be greyed out.
22
23 Most of AnaGram's windows simply format data which summarize your grammar.
24 The Trace windows, however, are interactive and allow you to explore your
25 grammar dynamically. Note that certain windows which show grammar rules or
26 reduction procedures are synched with your syntax file window for your
27 convenience. AnaGram's windows are summarized in Appendix C.
28
29
30 \section{Formats and Display Conventions}
31 \index{Display conventions}
32
33 AnaGram's data tables display relationships between character sets,
34 partition sets, tokens, grammar rules, and parser states. Generally,
35 each line of a table displays one such relationship.
36
37 \index{C000}\index{S000}\index{R000}\index{P000}\index{T000}
38 Each entity is uniquely identified by an appropriate number, with the
39 initial letter specifying what kind of entity is meant:
40 % ``T'' for token, ``S'' for state, ``R'' for rule, ``C'' for
41 % character set, and ``P'' for partition set. Thus C013 is character
42 % set 13, T049 is token 49, and so on.
43 \textit{T} for token, \textit{S} for state, \textit{R} for rule,
44 \textit{C} for character set, and \textit{P} for partition set. Thus
45 \textit{C013} is character set 13, \textit{T049} is token 49, and so on.
46 Generally when \index{Token}\index{Token number}
47 \index{Number}token numbers are displayed, the token name is also
48 given. When grammar rules are displayed, the rule itself is also
49 displayed. Furthermore, when rules are displayed, the table display
50 is synched with the display of the syntax file, so that you can see
51 the rule in context. Rules often are displayed with a ``marked
52 token'' in a distinctive font (which you may select) to indicate
53 progress in matching the rule. This signifies that the rule has been
54 matched up to the point just before the marked token. To continue
55 matching the rule, the next following input must either be the marked
56 token, if it is a terminal token, or must eventually reduce to it, if
57 it is nonterminal.
58
59 % Note: The % won't set in italic, so can't use \textit{} with it
60 If a token name is followed by a ``\%'' character it means that
61 AnaGram created a
62 \index{Shell production}\index{Production}\agterm{shell production}
63 for this token. The token with the ``\%'' is the basic input token and
64 the token without the ``\%'' is the shell production. AnaGram creates
65 shell productions when you use the
66 \index{Disregard statement}\index{Statement}\index{\_prc}\agparam{disregard}
67 statement to pass over certain characters or constructs in the input.
68 The \agparam{disregard} statement is discussed in Chapter 8.
69
70
71 \section{Character Sets}
72 \index{Character Sets}
73
74 AnaGram does an extensive analysis of the character sets you use in
75 your grammar. In particular, it checks to see if there are any
76 overlaps among your character sets. If so, it creates a
77 \index{Character universe}\index{Universe}\index{Partition}
78 \agterm{partition} of the character universe.
79
80 The \index{Character universe}\index{Universe}character universe
81 consists of the set of eight bit unsigned characters unless you have
82 defined characters outside this range. In such an event the character
83 universe will be extended down to negative values and above 255 only
84 so far as is necessary to include all the characters you have defined
85 in your grammar.
86
87 The \index{Partition}partition consists of a collection of mutually
88 disjoint sets, called \agterm{partition sets}, such that every
89 character in the \index{Character universe}\index{Universe}character
90 universe belongs to exactly one partition set and any one of your
91 character sets can be written uniquely as a union of partition sets.
92 AnaGram then adds a number of productions to your grammar which
93 describe your character sets in terms of the partition sets.
94
95 There are three primary tables you may use to see how the character
96 sets you have used in your grammar are analyzed by AnaGram. These are
97 the \index{Window}\agwindow{Character Sets} table, the
98 \index{Partition Sets}\index{Window}\agwindow{Partition Sets} table,
99 and the \index{Character Map}\index{Window}\agwindow{Character Map}
100 table. As described below, each of these tables provides access to
101 additional tables using the \agmenu{Auxiliary Windows} popup menu.
102 One auxiliary window, \agwindow{Set Elements}, can be used in any
103 window that identifies a character set, a partition set, or a terminal
104 token to see the characters that comprise the set, or, in the case of
105 a terminal token, that comprise the set of characters that corresponds
106 to the terminal token.
107
108 When you inspect these tables, you should verify that they correspond
109 to your understanding of your grammar. You should particularly check
110 to make sure that characters that show up as unused are really
111 supposed to be unused. On the other hand, do all the characters that
112 are shown to be used make sense?
113
114 \paragraph{Character Sets.}\index{Character Sets}\index{Window}
115 The \agwindow{Character Sets} window lists all of the distinct
116 character sets which you have defined, implicitly or explicitly, in
117 your grammar. Each line in the table describes one such set. The
118 description has the following fields:
119
120 \begin{itemize}
121 \item internal set number
122 \item token number if any
123 \item name, if any, followed by ``=''
124 \item the expression defining the set
125 \end{itemize}
126
127 The \agmenu{Auxiliary Windows} menu for the \agwindow{Character Sets}
128 window provides three options. The \agmenu{Partition Sets} option
129 displays the partition sets that cover the character set you have
130 selected. The \agmenu{Set Elements} window shows the composition of
131 the selected character set. If the character set corresponds to a
132 token in your grammar, the \agmenu{Token Usage} window will show all
133 rules in your grammar where the token is used.
134
135 % XXX provides -> generates?
136 \paragraph{Partition Sets.}\index{Partition Sets}\index{Window}
137 There are two Partition Sets windows available. From the
138 \agmenu{Window} menu, the \agmenu{Partition Sets} option provides a
139 list of all the sets that cover the character universe. From the
140 \agmenu{Auxiliary Windows} menu for the \agwindow{Character Sets}
141 table, the \agmenu{Partition Sets} option provides a list of the sets
142 that cover the selected character set. In this case, the character
143 set number appears on the title bar of the \agwindow{Partition Sets}
144 window.
145
146 Each line of a \agwindow{Partition Sets} window describes a particular
147 set in the covering. The description has the following fields:
148
149 \begin{itemize}
150 \item the partition set number
151 \item the token number assigned to this set
152 \item the token name, if any, that corresponds to this set
153 \end{itemize}
154
155 Partition set zero is the set of all characters in the character
156 universe that your parser does not accept. If one of the characters
157 in this set appears in the input to your parser, your parser will
158 signal a syntax error. You should check this set to make sure it
159 conforms to your expectations.
160
161 The \agmenu{Auxiliary Windows} menu for the \agwindow{Partition Sets}
162 window provides two options: \agmenu{Set Elements} and \agmenu{Token
163 Usage}. \agmenu{Set Elements} will display the characters which
164 comprise the partition set. \agmenu{Token Usage} will display all the
165 rules in your grammar that use the token assigned to this set. If
166 this particular partition set was developed by AnaGram because of an
167 overlap, it may not correspond precisely to any token in your grammar.
168 Under these circumstances there will be no explicit usage in your
169 grammar and \agmenu{Token Usage} will be greyed out in the
170 \agmenu{Auxiliary Windows} menu.
171 % ...but in that case shouldn't it show which *used* character sets it
172 % appears in?
173 % also, XXX: s/developed/generated/
174
175 \paragraph{Character Map.}\index{Character Map}\index{Window}
176 The \agwindow{Character Map} table shows you the mapping of input
177 characters to token numbers. The \agcode{ag{\us}tcv} table in your
178 parser is based on the information in this table.
179
180 The fields in this table are, in order:
181
182 \begin{itemize}
183 \item \index{Character codes}character code
184 \item display character (if any)
185 \item partition set number
186 \item token number
187 \item token representation
188 \end{itemize}
189
190 The display character will be whatever Windows displays for this code
191 in the \agoption{Data Tables} font you have chosen. If a character is
192 not used in your grammar the token number and token representation are
193 both \index{T000}\textit{T000}. The \agmenu{Auxiliary Windows} popup
194 menu provides two options: \agmenu{Set Elements} and \agmenu{Token
195 Usage}. \agmenu{Set Elements} shows the elements of the partition set
196 to which the selected character belongs. The \agmenu{Token Usage}
197 window shows the rules in your grammar in which the token
198 corresponding to this partition set number is used.
199
200 \paragraph{Set Elements.}\index{Set Elements}\index{Window}
201
202 The Set Elements window can be accessed only through the
203 \agmenu{Auxiliary Windows} menu in a window that identifies a
204 character set, a partition set, or a terminal token. The
205 \agwindow{Set Elements} window shows the numeric code and screen
206 representation for each element of the set. The character set or
207 partition set number is displayed in the title bar of the window. In
208 the case of a terminal token, the character set displayed is the
209 character set corresponding to the terminal token.
210
211 There is no \agmenu{Auxiliary Windows} menu defined for the
212 \agwindow{Set Elements} window.
213
214
215 \section{The Elements of Your Grammar}
216
217 In analyzing your syntax, AnaGram takes it completely apart and
218 creates an internal representation of it. A number of the internal
219 tables are available for your inspection.
220
221 Two tables, the
222 \index{Symbol Table}\index{Window}\index{Table}\agwindow{Symbol Table}
223 and the
224 \index{Token Table}\index{Window}\index{Table}\agwindow{Token Table},
225 identify the elementary constituents of your grammar. A third, the
226 \index{Rule Table}\index{Window}\index{Table}\agwindow{Rule Table},
227 summarizes the grammar AnaGram has abstracted from your syntax file.
228 The \agwindow{Symbol Table} and \agwindow{Token Table} are not
229 equivalent since you may have named character sets which are not
230 tokens. You may also have tokens which you have defined directly as
231 character sets or character ranges and therefore have no names.
232
233 A number of \agwindow{Auxiliary Windows} also provide useful
234 information about the tokens in your grammar. These are the
235 \agwindow{Expansion Chain}, \agwindow{Expansion Rules},
236 \agwindow{Productions}, \agwindow{Rule Context}, \agwindow{Set
237 Elements}, and \agwindow{Token Usage} windows.
238
239 \paragraph{Symbol Table.}\index{Symbol Table}\index{Window}\index{Table}
240 The \agwindow{Symbol Table} lists all the symbols you used in your
241 grammar. Symbols may be used, of course, to identify tokens,
242 definitions, or virtual productions or to provide alternative names
243 for tokens.
244
245 Each line in this table identifies a single symbol. The first field
246 is the token number, if any. This is followed by the name. If the
247 name was defined by a definition statement, it is followed by an equal
248 sign and the right side of the definition. The \agmenu{Auxiliary
249 Windows} menu for the \agwindow{Symbol Table} has four options:
250 \agmenu{Expansion Rules}, \agmenu{Productions}, \agmenu{Set Elements},
251 and \agmenu{Token Usage}. The \agmenu{Expansion Rules} and
252 \agmenu{Productions} windows exist only for symbols which name
253 nonterminal tokens. The \agmenu{Set Elements} window exists only for
254 symbols which name character sets or terminal tokens. The
255 \agmenu{Token Usage} table exists for any symbol which names a token.
256
257 \paragraph{Token Table.}\index{Token Table}\index{Window}\index{Table}
258 The \agwindow{Token Table} lists all the tokens of your grammar. The
259 first field is the token number. It is followed by a flag field which
260 is \textit{zl} if the token is a nonterminal token and is \index{Zero
261 length token}\index{Token}zero length. If the token is nonterminal
262 and not zero length, the flag field contains \textit{nt}. If the
263 token is a terminal token, the field is blank. The next field is
264 blank unless the token has been declared \index{Sticky
265 declaration}\agparam{sticky} or has had a precedence level assigned.
266 If the token is sticky, this field will contain \textit{s}. If a
267 precedence level has been assigned, this field will contain the letter
268 \textit{l}, \textit{r}, or \textit{n} to indicate associativity
269 followed by the precedence level. Finally there is the
270 \index{Data type}\index{Token}data type
271 of the semantic value of this token and the token representation.
272
273 The \agmenu{Auxiliary Windows} menu for the \agwindow{Token Table} has
274 four options: \agmenu{Expansion Rules}, \agmenu{Productions},
275 \agmenu{Set Elements} and \agmenu{Token Usage}. The \agmenu{Expansion
276 Rules} and \agmenu{Productions} windows exist only for nonterminal
277 tokens. \agmenu{Set Elements} exists only for terminal tokens.
278
279 If you have used
280 \index{Disregard statement}\index{Statement}\agparam{disregard}
281 statements to cause white space or other uninteresting text to be
282 skipped in the input to your parser, many of your tokens will appear
283 in the \agwindow{Token Table} twice: once in the normal form and once
284 with the ``\%'' character appended. For instance, if you have
285 specified that \agcode{space} be disregarded after \agcode{name},
286 there will be entries for both \agcode{name} and
287 \agcode{name\%}\index{ \_prc}. In this case, \agcode{name\%}
288 represents the simple token and \agcode{name} represents
289 \agcode{name\%} followed by \agcode{space?...}
290
291 It is a good idea to check the \agwindow{Token} and \agwindow{Symbol}
292 tables from time to time to make sure that all the names are the ones
293 you intended and not the result of typographical errors.
294
295 \paragraph{Rule Table.}\index{Rule Table}\index{Window}\index{Table}
296 The \agwindow{Rule Table} lists, in numerical order, all the grammar
297 rules defined in your grammar. Each rule is preceded by the
298 nonterminal tokens which produce it. If you are not using
299 semantically determined productions, then there will be precisely one
300 token line per rule. The \agwindow{Rule Table} is synched to your
301 syntax file to show the rule in context.
302
303 The \agmenu{Auxiliary Windows} popup menu for the \agwindow{Rule
304 Table} has four options: \agmenu{Expansion Rules},
305 \agmenu{Productions}, \agmenu{Rule Context} and \agmenu{Token Usage}.
306 The \agmenu{Expansion Rules}, \agmenu{Productions} and \agmenu{Token
307 Usage} windows are keyed to the lines in the \agwindow{Rule Table}
308 which identify tokens. AnaGram will beep if you select one of these
309 options while a rule is highlighted. The \agmenu{Rule Context} window
310 is keyed to the highlighted rule, or, if a token is highlighted, the
311 next following rule.
312
313 \paragraph{Expansion Rules.}\index{Expansion Rules}\index{Window}
314 The \agwindow{Expansion Rules} window is available in the
315 \agmenu{Auxiliary Windows} menu from any window that identifies
316 tokens. It displays a complete left expansion of the selected token
317 if the token is nonterminal. That is, it is a list of rules that
318 begins with all the rules produced by the token, plus all the rules
319 produced by the first token of any rule in the list. The token number
320 and the name or other representation of the token being expanded is
321 displayed on the title bar of the window. The \agwindow{Expansion
322 Rules} window is synched with the syntax file window so you can see
323 each rule in context.
324
325 The \agwindow{Auxiliary Windows} available from the \agwindow{Expansion
326 Rules} window are the \agwindow{Expansion Chain}, \agwindow{Expansion
327 Rules}, \agwindow{Productions}, \agwindow{Rule Context}, \agwindow{Set
328 Elements}, and \agwindow{Token Usage} windows, all keyed to the marked
329 token in the highlighted rule.
330
331 \paragraph{Expansion Chain.}\index{Expansion Chain}\index{Window}
332 The \agwindow{Expansion Chain} window is available in the
333 \agmenu{Auxiliary Windows} menu from any window that contains
334 expansion rules, in particular, from the \agwindow{Expansion Rules}
335 window, from a \agwindow{Conflicts} or \agwindow{Rule Stack} window
336 (see Chapter 7), from a \agwindow{State Expansion} window (see below),
337 or even from an \agwindow{Expansion Chain} window.
338 % XXX that last ``an'' should be ``another''
339
340 The purpose of an \agwindow{Expansion Chain} window is to show how a
341 particular expansion rule in a particular state derives from a
342 characteristic rule for that state. To see a chain of productions
343 that produces a desired expansion rule, select the expansion rule with
344 the cursor bar, click the right mouse button for the
345 \agwindow{Auxiliary Windows} menu, and select \agmenu{Expansion
346 Chain}. The \agwindow{Expansion Chain} window will then present a
347 sequence of expansion rules, using the same format as the
348 \agwindow{Expansion Rules} window, but subject to the constraint that
349 each rule is produced by the marked token in the previous line. The
350 first rule in the window is a characteristic rule for the given state.
351 The last rule in the window is the rule selected by the cursor bar in
352 the window from which you chose the \agwindow{Expansion Chain}. It
353 should be noted that this expansion is not unique. There may be other
354 derivations.
355
356 \paragraph{Productions.}\index{Window}\index{Productions}
357 The \agwindow{Productions} window is available in the
358 \agmenu{Auxiliary Windows} popup menu from any window which identifies
359 tokens. If the token selected by the cursor bar is a terminal token,
360 the \agmenu{Productions} option will be greyed out. Otherwise, it
361 will show all the rules the given token produces. The
362 \agwindow{Productions} window is synched with the syntax file window
363 so you can see each rule in context. The \agwindow{Productions}
364 window does not have an \agmenu{Auxiliary Windows} menu.
365
366 \paragraph{Reduction Procedures.}
367 The \agwindow{Reduction Procedures} window lists the C function
368 prototypes for the reduction procedures in your grammar. When this
369 window is active, the syntax file window, if visible, is synchronized
370 with it so you can see the body of the reduction procedure as well as
371 its usage.
372
373 \paragraph{Rule Context.}\index{Rule Context}\index{Window}
374 The \agwindow{Rule Context} window is available in the
375 \agmenu{Auxiliary Windows} popup menu from any window which identifies
376 rules. When you select the \agwindow{Rule Context} window, AnaGram
377 finds all the tokens which produce the selected rule and then finds
378 all rules in your grammar which use any of these rules.
379
380 The \agmenu{Auxiliary Windows} menu for the \agwindow{Rule Context}
381 window offers five options: \agmenu{Expansion Rules},
382 \agmenu{Productions}, \agmenu{Rule Context}, \agmenu{Set Elements} and
383 \agmenu{Token Usage}. The \agmenu{Rule Context} option is keyed to
384 the highlighted rule in the original \agwindow{Rule Context} window.
385 The remaining windows are keyed to the marked token in the highlighted
386 rule in the original \agwindow{Rule Context} window.
387
388 \paragraph{Token Usage.}\index{Token Usage}\index{Window}
389 The \agwindow{Token Usage} window is available in the
390 \agmenu{Auxiliary Windows} popup menu from any window which identifies
391 tokens. It displays all rules in your grammar which use the specified
392 token. The rules are displayed with a marked token, and
393 \agwindow{Auxiliary Windows} accessed from the \agwindow{Token Usage}
394 window will be keyed to the marked token which is the one following
395 the specified token.
396 % XXX the above sentence needs to be shot
397
398 The \agmenu{Auxiliary Windows} menu for the \agwindow{Token Usage}
399 window offers five options: \agmenu{Expansion Rules},
400 \agmenu{Productions}, \agmenu{Rule Context}, \agmenu{Set Elements} and
401 \agmenu{Token Usage}. The \agmenu{Rule Context} option is keyed to the
402 highlighted rule in the \agwindow{Token Usage} window. The remaining
403 windows are keyed to the marked token in the highlighted rule in the
404 original \agwindow{Token Usage} window.
405
406
407 \section{State Tables}
408 \index{State}
409
410 When AnaGram analyzes your grammar, the principal result is the
411 definition of parser states. AnaGram provides one table, the
412 \agwindow{State Definition} table, listed in the \agmenu{Window} menu,
413 which describes all the states in the parser. It also provides a
414 number of \agwindow{Auxiliary Windows} that show the relationships
415 among the states and the elements of your grammar.
416
417 \paragraph{State Definition Table.}
418 \index{State Definition Table}\index{Window}\index{Table}\index{Table}
419 The \agwindow{State Definition Table} lists the rules which define the
420 states of your parser. Each line contains the state number, which is
421 blank if it is the same as the state number of the previous line, the
422 rule number and finally the rule itself. The cursor in the syntax
423 file window is synched with the cursor bar to show the grammar rule in
424 context.
425
426 Each state is defined by one or more rules, displayed with a marked
427 token\index{Rule}\index{Token}\index{Marked rule} in a distinctive
428 font. The meaning of the marked token is this: If your parser is in
429 this state, it has accumulated, in the input buffer, all of the tokens
430 in the rule that are to the left of the marked token. Further input
431 must be consistent with the marked token in one or the other of the
432 defining rules. If there is no marked token, the rule is a completed
433 rule, and an appropriate lookahead token will cause the rule to be
434 reduced.
435
436 The marked rules that define a particular state of a parser are
437 sometimes called the
438 \index{Characteristic rules}\index{Rules}\agterm{characteristic rules}
439 of the state.
440
441 The \agmenu{Auxiliary Windows} menu for the \agwindow{State Definition
442 Table} offers ten choices. Four are keyed to the marked token in the
443 highlighted rule: \agwindow{Expansion Rules}, \agwindow{Productions},
444 \agwindow{Set Elements}, and \agwindow{Token Usage}. One,
445 \agwindow{Rule Context}, is keyed simply to the highlighted rule.
446 Four are keyed only to the highlighted state: \agwindow{Auxiliary
447 Trace}, \agwindow{Keywords}, \agwindow{Previous States}, and
448 \agwindow{State Expansion}. One, \agwindow{Reduction States}, is
449 keyed to the combination of rule number and state number. It is
450 available only for completed rules.
451
452 \paragraph{State Definition.}
453 \index{State Definition}\index{Window}
454 For some windows which identify a state but do not show its
455 definition, the Auxiliary Windows menu contains an entry to display
456 the \index{Characteristic rules}\index{Rules}characteristic rules
457 which identify the state. The state number is displayed on the title
458 bar of the window.
459
460 The \agwindow{Auxiliary Windows} choices for a \agwindow{State
461 Definition} window are the same as for the general \agwindow{State
462 Definition Table}.
463
464 \paragraph{Auxiliary Trace.}
465 \index{Auxiliary Trace}\index{Window}\index{Trace}
466 \agwindow{Auxiliary Trace} windows may be accessed through the
467 \agmenu{Auxiliary Windows} menu. The \agwindow{Auxiliary Trace} is a
468 prebuilt \agwindow{Grammar Trace} showing one of perhaps many ways to
469 get to the state identified by the cursor bar in the parent window.
470 See Chapter 5 for a discussion of the \agwindow{Grammar Trace}.
471
472 \paragraph{Keywords.}\index{Keywords}\index{Window}
473 When you select \agmenu{Keywords} in the \agmenu{Window} menu, AnaGram
474 displays a list of all the keywords defined in your grammar together
475 with the token numbers assigned to them. When you select
476 \agmenu{Keywords} in an \agmenu{Auxiliary Windows} menu, AnaGram
477 displays a list of keywords which your parser will identify in the
478 state determined by the cursor in the parent window. It displays all
479 the keywords the parser will recognize in that state, regardless of
480 whether they are used as shift or as reducing tokens. The state
481 number is displayed on the title bar of the window.
482
483 The \agmenu{Auxiliary Windows} menu for a \agwindow{Keywords Window}
484 has only one option: \agmenu{Token Usage}, so you can see all uses of
485 a given keyword in your grammar.
486
487 \paragraph{Previous States.}\index{Previous States}\index{Window}
488 A \agwindow{Previousf States} window can be accessed via the
489 \agmenu{Auxiliary Windows} menu from any window which identifies
490 parser states. It shows the defining rules for all the states which
491 jump to the specified state. The \agmenu{Auxiliary Windows} options for a
492 \agwindow{Previous States} window are the same as for the
493 \agwindow{State Definition Table}.
494
495 \paragraph{Reduction States.}\index{Window}\index{Reduction States}
496 A \agwindow{Reduction States} window can be accessed via the
497 \agmenu{Auxiliary Windows} menu from most windows which display marked
498 rules with a specified state. In this case, if the highlighted rule
499 is complete, that is, there is no marked token, the \agmenu{Reduction
500 States} option will show you all the possible states the parser could
501 go to on reducing the rule. The actual state your parser will go to
502 depends on the actual sequence of tokens which brought your parser to
503 the state you are investigating. The \agwindow{Reduction States}
504 window is very useful in understanding conflicts and keyword
505 anomalies. A special version of this window, called \agwindow{Problem
506 States}, is available from the \agmenu{Auxiliary Windows} menu of the
507 \agwindow{Conflicts} window.
508
509 The \agmenu{Auxiliary Windows} options for a \agwindow{Reduction
510 States} window are the same as for the \agwindow{State Definition
511 Table}.
512
513 \paragraph{State Expansion.}\index{State Expansion}\index{Window}
514 The \agwindow{State Expansion} window may be accessed using the
515 \agmenu{Auxiliary Windows} menu from any window that identifies a
516 state. It shows the complete set of expansion rules for the state,
517 consisting of the union of the set of characteristic rules and the
518 sets of expansion rules for the token to the right of the mark in each
519 characteristic rule. The \agwindow{State Expansion} window shows all
520 possible legal input to your parser in the given state. The state
521 itself is identified on the title bar of the window.
522
523 The \agmenu{Auxiliary Windows} menu for the \agwindow{State Expansion}
524 window has two options keyed to the state number: \agmenu{Auxiliary Trace} and
525 \agmenu{Previous States}; two options keyed to the state number and rule
526 number: \agmenu{Expansion Chain} and \agmenu{Reduction States}; four
527 options keyed to the marked token in the highlighted rule:
528 \agmenu{Expansion Rules}, \agmenu{Productions}, \agmenu{Set Elements},
529 and \agmenu{Token Usage}; and one option keyed simply to the
530 highlighted rule: \agmenu{Rule Context}.
531
532
533 \section{Coverage Analysis Tables}
534
535 AnaGram provides two tables on the \agmenu{Browse} menu,
536 \agwindow{Rule Coverage} and \agwindow{Trace Coverage}, to let you see
537 which grammar rules have been identified by your parser in the course
538 of your testing. \agwindow{Rule Coverage} is described in Chapter 9,
539 Programming With AnaGram. \agwindow{Trace Coverage} is described in
540 Chapter 5, Exploring Your Grammar I: Traces.
541