Debian Codegraph @

documentation/manual/demos/rpndecl.yo

raw
1 Here are the directives that are used for the reverse polish notation
2 calculator. As in bf(C++), end-of-line comments may be used.
3 verbinsert(//DECL rpn/parser/grammar)
4 The grammar file's first (directive) configures b() by specifying the
5 tokens (see section The b() Declarations Section). Each terminal symbol that
6 is not a single-character literal must be declared here (Single-character
7 literals are normally not declared, but are represented by literal character
8 constants). In the current example, all arithmetic operators are designated by
9 single-character literals, so the only terminal symbol that needs to be
10 declared is tt(NUM), the token type for numeric constants. As b() by default
11 uses the type tt(int) as the semantic value type, but a calculator usually
12 uses floating point values the directive tt(%stype double) is used to indicate
13 that the calculator uses `tt(double)' as the type for its semantic values.
14
15
16
17