Debian Codegraph @

documentation/manual/concepts/layout.yo

raw
1 B() processes a file containing a grammar definition. Different
2 from Bison++ and Bison grammar files, b()'s grammar file consists of only
3 two sections. The general form of a b() grammar file is as follows:
4 verb(
5 Bisonc++ directives
6 %%
7 Grammar rules
8 )
9 Readers familiar with Bison may note that there is no em(C declaration
10 section) and no section to define em(Additional C code). With b() these
11 sections are superfluous since, due to the fact that a b() parser is a class,
12 all additionally required code can be incorporated into the parser class
13 itself. Also, bf(C++) classes normally only require declarations that can be
14 provided in the classes' header files, so also the `additional C code' section
15 was omitted from the grammar file.
16
17 The `%%' is a punctuation that appears in every b() grammar file to
18 separate the two sections.
19
20 The b() directives section contains all necessary directive specifications,
21 like directives declaring the names of the terminal and nonterminal symbols,
22 and directives describing operator precedence, and the data types of semantic
23 values of various symbols.
24
25 The file's second section (grammar rules) is used to define how to construct
26 each nonterminal symbol from its parts.
27
28 One special directive is availble that may be used in both the directives
29 section and in the grammar rules section. This directive is tt(%include),
30 allowing you to split long grammar specifications into smaller, more
31 comprehensible and accessible chunks. The tt(%include) directive is discussed
32 in more detail in section ref(INCLUDE).