Debian Codegraph @

documentation/manual/grammar/polydollar.yo

raw
1 itemization(
2 itt($$ = )
3
4 A semantic value is assigned to the rule's nonterminal's semantic
5 value. The right-hand side (rhs) of the assignment expression must be an
6 expression of the type that is associated with $$. This assignment operation
7 assumes that the type of the rhs-expression equals $$'s semantic value
8 type. If the types don't match the compiler issues a compilation error when
9 compiling tt(parse.cc). Casting the rhs to the correct value type is possible,
10 but in that case the function call operator (see the next item) is preferred,
11 as it does not require casting. If no semantic value type was associated with
12 $$ then the assignment tt($$ = STYPE_{}) can be used.
13
14 itt($$(expr))
15
16 A value is assigned to the rule's nonterminal's semantic value. tt(Expr)
17 must be of a type that can be statically cast to $$'s semantic value type. The
18 required tt(static_cast) is generated by bic() and doesn't have to be
19 specified for tt(expr).
20
21 itt(_$$)
22
23 This refers to the rule's nonterminal's semantic value, disregarding any
24 polymorphic type that might have been associated with the rule's nonterminal.
25
26 itt($$)
27
28 If no polymorphic type was associated with the rule's nonterminal then
29 this is shorthand for a reference to the rule's plain tt(STYPE_) value. If a
30 polymorphic value type was associated with the rule's nonterminal then this
31 shorthand represents a reference to a value of that particular type.
32
33 itt($$.)
34
35 If no polymorphic type was associated with the rule's nonterminal then
36 this is shorthand for the member selector operator, applied to a reference to
37 the rule's nonterminal's tt(STYPE_) value. If a polymorphic value type was
38 associated with the rule's nonterminal then this shorthand represents the
39 member selector operator, applied to a reference of that particular type.
40
41 itt($$->)
42
43 If no polymorphic type was associated with the rule's nonterminal then
44 this is shorthand for the pointer to member operator, applied to a reference
45 to the rule's nonterminal's tt(STYPE_) value. If a polymorphic value type
46 was associated with the rule's nonterminal then this shorthand represents the
47 pointer to member operator, applied to a reference of that particular type.
48
49 itt(_$1)
50
51 This refers to the current production rule's first component's generic
52 tt(STYPE_) value.
53
54 itt($1)
55
56 This shorthand refers to the semantic value of the production rule's
57 first element. If it was associated with a polymorphic type, then tt($1)
58 refers to a value of that particular type. If no association was defined then
59 tt($1) represents a generic tt(STYPE_) value.
60
61 itt($1.)
62
63 If the production rule's first component's semantic value was associated
64 with a polymorphic type, then tt($1.) is shorthand for the member selector
65 operator, applied to the value of the associated polymorphic type. If no
66 association was defined then tt($1.) is shorthand for the member selector
67 operator, applied to the first component's generic tt(STYPE_) value.
68
69 itt($1->)
70
71 If the production rule's first component's semantic value was associated
72 with a polymorphic type, then tt($1->) is shorthand for the pointer to member
73 operator, applied to the value of the associated polymorphic type. If no
74 association was defined then tt($1.) is shorthand for the pointer to member
75 operator, applied to the first component's generic tt(STYPE_) value.
76
77 itt(_$-1)
78
79 This refers to the generic (tt(STYPE_)) value of a component in a
80 production rule, listed immediately before the current rule's nonterminal ($-2
81 refers to a component used two elements before the current nonterminal, etc.).
82
83 itt($-1)
84
85 Same: this refers to the generic (tt(STYPE_)) value of a component in a
86 production rule, listed immediately before the current rule's nonterminal ($-2
87 refers to a component used two elements before the current nonterminal, etc.).
88
89
90 itt($-1.)
91
92 This is shorthand for the member selector operator applied to to the
93 generic tt(STYPE_) value of some production rule element, 1 element before
94 the current rule's nonterminal.
95
96 itt($-1->)
97
98 This is shorthand for the pointer to member operator applied to to the
99 generic tt(STYPE_) value of some production rule element, 1 element before
100 the current rule's nonterminal.
101
102 itt($<tag>-1)
103
104 This shorthand represents a reference to the semantic value of the
105 polymorphic type associated with tt(tag) of some production rule element, 1
106 element before the current rule's nonterminal.
107
108 If, when using the generated parser's class tt(parse) function, the
109 polymorphic type of that element turns out not to match the type that is
110 associated with tt(tag) then a run-time fatal error results.
111
112 If that happens, and the tt(debug) option/directive had been specified when
113 bic() was run, then rerun the program after specifying
114 tt(parser.setDebug(Parser::ACTIONCASES)) to locate the tt(parse) function's
115 action block where the fatal error was encountered.
116
117 itt($<tag>-1.)
118
119 This shorthand represents the member selector operator, applied to the
120 semantic value of the polymorphic type associated with tt(tag) of some
121 production rule element, 1 element before the current rule's nonterminal.
122
123 If, when using the generated parser's class tt(parse) function, the
124 polymorphic type of that element turns out not to match the type that is
125 associated with tt(tag) then a run-time fatal error results. The procedure
126 suggested at the previous (tt($<tag>-1)) item for solving such errors can be
127 applied here as well.
128
129 itt($<tag>-1->)
130
131 This shorthand represents the pointer to member selector operator, applied
132 to the semantic value of the polymorphic type associated with tt(tag) of some
133 production rule element, 1 element before the current rule's nonterminal.
134
135 If, when using the generated parser's class tt(parse) function, the
136 polymorphic type of that element turns out not to match the type that is
137 associated with tt(tag) then a run-time fatal error results. The procedure
138 suggested at the previous (tt($<tag>-1)) item for solving such errors can be
139 applied here as well.
140 )