Lines Matching full:semantic
86 * Semantic Values:: Each token or syntactic grouping can have
87 a semantic value (the value of an integer,
89 * Semantic Actions:: Each rule can have an action containing C code.
101 * GLR Semantic Actions:: Deferred semantic actions have special concerns.
113 It uses multiple data-types for semantic values.
150 * Semantics:: Semantic values and actions.
166 * Value Type:: Specifying one data type for all semantic values.
168 * Actions:: An action is the semantic definition of a grammar rule.
191 * Union Decl:: Declaring the set of all semantic value types.
221 * Token Values:: How `yylex' must return the semantic value
259 * Semantic Tokens:: Token parsing can depend on the semantic context.
275 * The YYPRINT Macro:: Obsolete interface for semantic value reports
292 * C++ Semantic Values:: %union vs. C++
315 * Java Semantic Values:: %type and %token vs. Java
1154 * Semantic Values:: Each token or syntactic grouping can have
1155 a semantic value (the value of an integer,
1157 * Semantic Actions:: Each rule can have an action containing C code.
1281 File: bison.info, Node: Grammar in Bison, Next: Semantic Values, Prev: Language and Grammar, Up: Concepts
1323 File: bison.info, Node: Semantic Values, Next: Semantic Actions, Prev: Grammar in Bison, Up: Concepts
1325 1.3 Semantic Values
1338 token in a Bison grammar has both a token type and a "semantic value".
1347 The semantic value has all the rest of the information about the
1350 need to have any semantic value.)
1353 `INTEGER' and have the semantic value 4. Another input token might
1357 keeps track of the token's semantic value.
1359 Each grouping can also have a semantic value as well as its
1361 typically has a semantic value that is a number. In a compiler for a
1362 programming language, an expression typically has a semantic value that
1366 File: bison.info, Node: Semantic Actions, Next: GLR Parsers, Prev: Semantic Values, Up: Concepts
1368 1.4 Semantic Actions
1378 semantic value of the whole construct from the semantic values of its
1381 sum, each of the subexpressions has a semantic value which describes
1390 The action says how to produce the semantic value of the sum expression
1394 File: bison.info, Node: GLR Parsers, Next: Locations, Prev: Semantic Actions, Up: Concepts
1426 During the time that there are multiple parsers, semantic actions are
1428 semantic actions disappear as well, and are never performed. When a
1430 records both sets of semantic actions. Whenever the last two parsers
1441 * GLR Semantic Actions:: Deferred semantic actions have special concerns.
1487 contortions in both semantic actions and large parts of the grammar,
1584 the lexer (*note Semantic Tokens::) with great care. Since a split
1600 File: bison.info, Node: Merging GLR Parses, Next: GLR Semantic Actions, Prev: Simple GLR Parsers, Up: GLR Parsers
1699 all the possibilities. For this purpose, you must merge the semantic
1736 File: bison.info, Node: GLR Semantic Actions, Next: Compiler Requirements, Prev: Merging GLR Parses, Up: GLR Parsers
1738 1.5.3 GLR Semantic Actions
1741 By definition, a deferred semantic action is not performed at the same
1743 Bison features you might use in a semantic action in a GLR parser.
1745 In any semantic action, you can examine `yychar' to determine the
1749 lookahead token's semantic value and location, if any. In a
1750 nondeferred semantic action, you can also modify any of these variables
1753 In a deferred semantic action, it's too late to influence syntax
1758 change with future versions of Bison. For example, if a semantic
1764 (*note Action Features::), which you can invoke in a semantic action to
1767 In a deferred semantic action, its effect is undefined.
1774 File: bison.info, Node: Compiler Requirements, Prev: GLR Semantic Actions, Up: GLR Parsers
1810 Each token has a semantic value. In a similar fashion, each token
1816 Like semantic values, locations can be reached in actions using a
1822 semantic value of its left hand side (*note Actions::). In the same
1852 doesn't know what is "inside" the tokens (though their semantic values
1953 data types of semantic values of various symbols.
1987 It uses multiple data-types for semantic values.
2041 the C data type for semantic values of both tokens and groupings (*note
2042 Data Types of Semantic Values: Value Type.). The Bison parser will use
2104 passing semantic values between the rules. In each action, the
2105 pseudo-variable `$$' stands for the semantic value for the grouping
2107 main job of most actions. The semantic values of the components of the
2169 semantic value of the `exp' grouping is the value of `$1' because the
2175 As a consequence, the semantic value associated with the `line' is
2211 associated semantic value, but if it had one you could refer to it as
2264 The semantic value of the token (if it has one) is stored into the
2638 This code shows how to reach locations inside of semantic actions, by
2658 semantic values.
2711 number as well as its semantic value, and its location in the text.
2805 language. These features allow semantic values to have various data
2814 associate a type with each grammar symbol whose semantic value is used.
3131 * Semantics:: Semantic values and actions.
3438 semantic-type-related directives by semantic type:
3452 associated semantic type. (In the rules section, you must terminate
3557 specify its semantic value data type (*note Data Types of Semantic
3577 doesn't need to be declared unless you need to specify its semantic
3787 semantics are determined by the semantic values associated with various
3798 * Value Type:: Specifying one data type for all semantic values.
3800 * Actions:: An action is the semantic definition of a grammar rule.
3809 3.5.1 Data Types of Semantic Values
3813 the semantic values of all language constructs. This was true in the
3817 Bison normally uses the type `int' for semantic values if your
3839 To use more than one data type for semantic values in one parser,
3849 nonterminal) for which semantic values are used. This is done for
3862 most actions is to compute a semantic value for the grouping built by
3863 the rule from the semantic values associated with tokens or smaller
3873 The C code in an action can refer to the semantic values of the
3875 for the value of the Nth component. The semantic value for the
3876 grouping being constructed is `$$'. In addition, the semantic values
3898 and `$right') refer to the semantic values of the two component `exp'
3901 becomes the semantic value of the addition-expression just recognized
3902 by the rule. If there were a useful semantic value associated with the
3941 It is also possible to access the semantic value of the lookahead
3942 token, if any, from a semantic action. This semantic value is stored
3952 If you have chosen a single data type for semantic values, the `$$' and
3957 nonterminal symbol that can have a semantic value. Then each time you
4014 The mid-rule action can also have a semantic value. The action can
4046 run. It saves a copy of the current semantic context (the list of
4047 accessible variables) as its semantic value, using alternative
4068 After the embedded statement is parsed, its semantic value becomes
4069 the value of the entire `let'-statement. Then the semantic value from
4076 `stmt', it might discard the previous semantic context `$<context>5'
4080 mid-rule action's semantic value.
4241 Though grammar rules and semantic actions are enough to write a fully
4260 Defining a data type for locations is much simpler than for semantic
4264 `YYLTYPE', just as you can specify the semantic value type by defining
4292 is very similar to the way semantic values are computed. In a given
4325 As for semantic values, there is a default action for locations that
4350 if any, from a semantic action. This location is stored in `yylloc'.
4360 locations are much more general than semantic values, there is room in
4369 dedicated code from semantic actions.
4411 * For consistency with semantic actions, valid indexes within the
4428 any semantic value or location is a "positional reference", which takes
4434 To avoid these issues, you can also refer to a semantic value or
4464 In order to access a semantic value generated by a mid-rule action, an
4478 `.suffix', i.e., an access to the `suffix' field of the semantic value.
4480 the name of a semantic value, the bracketed syntax `$[name.suffix]'
4493 used in formulating the grammar and the data types of semantic values.
4498 declared if you need to specify which data type to use for the semantic
4511 * Union Decl:: Declaring the set of all semantic value types.
4660 data types for semantic values. The keyword `%union' is followed by
4780 SYMBOLS. Within CODE, `$$' (or `$<TAG>$') designates the semantic
4787 `%destructor' by listing a semantic type tag among SYMBOLS. In
4789 any grammar symbol that has that semantic type tag unless that
4801 you have formally declared a semantic type tag (`%type' counts as
4804 declared semantic type tag.
4824 has a semantic type tag other than `<character>', it passes its
4825 semantic value to `free' by default. However, when the parser discards
4829 it discards any symbol, such as `TAGLESS', that has no semantic type
4846 mid-rule semantic value (*note Actions in Mid-Rule: Mid-Rule Actions.).
4847 That is, Bison does not consider a mid-rule to have a semantic value if
4881 3.8.8 Printing Semantic Values
4887 parser cannot know how semantic values should be formatted.
4897 designates the semantic value associated with the symbol, and `@$'
4923 guarantees that, when the parser print any symbol that has a semantic
4925 semantic value by default. However, when the parser displays a
4929 that has no semantic type tag. See also
5140 Declare the collection of data types that semantic values may have
5161 Declare the type of semantic values for a nonterminal symbol
5206 a `YYSTYPE' macro or type definition (*note Data Types of Semantic
5223 declarations and to the token type codes. *Note Semantic Values
5936 * Token Values:: How `yylex' must return the semantic value
6022 4.6.2 Semantic
6025 In an ordinary (nonreentrant) parser, the semantic value of the token
6027 just one data type for semantic values, `yylval' has that type. Thus,
6205 Acts like a variable that contains the semantic value for the
6209 Acts like a variable that contains the semantic value for the Nth
6234 with token type TOKEN and semantic value VALUE; then it discards
6267 Do not modify `yychar' in a deferred semantic action (*note GLR
6268 Semantic Actions::). *Note Lookahead Tokens: Lookahead.
6272 error rules. Do not invoke `yyclearin' in a deferred semantic
6273 action (*note GLR Semantic Actions::). *Note Error Recovery::.
6283 deferred semantic action (*note GLR Semantic Actions::). *Note
6287 Variable containing the lookahead token semantic value when
6289 `yylval' in a deferred semantic action (*note GLR Semantic
6368 semantic values. The stack is called the "parser stack". Pushing a
6381 reduction, because this is what computes the semantic value of the
6470 semantic value and location, if any, are stored in the variables
7223 of `yylex' can influence or be influenced by the semantic actions
7226 significant. For example, the semantic actions might pop a scope
7295 reductions can perform user semantic actions that are unexpected because
7328 perform user semantic actions. If the exploratory parse reaches a
7383 lexical analysis performed by the scanner, and the user's semantic
7474 immediately. When a stack disappears, its saved semantic actions never
7476 their sets of semantic actions are both saved with the state that
7485 transition, some of the states on the stack will have semantic values
7553 Because of semantic differences between C and C++, the deterministic
7606 part of the semantic context and part of the input. First it discards
7688 * Semantic Tokens:: Token parsing can depend on the semantic context.
7697 File: bison.info, Node: Semantic Tokens, Next: Lexical Tie-ins, Up: Context Dependency
7699 7.1 Semantic Info in Token Types
7771 File: bison.info, Node: Lexical Tie-ins, Next: Tie-in Recovery, Prev: Semantic Tokens, Up: Context Dependency
8437 * The YYPRINT Macro:: Obsolete interface for semantic value reports
8521 read, but not its semantic value. The `%printer' directive allows
8522 specify how semantic values are reported, see *note Printing Semantic
8529 traces, and semantic value reports, insert the following directives in
8537 /* Formatting semantic values. */
8550 semantic value in the traces. Note that the specification can be done
8668 Before `%printer' support, semantic values could be displayed using the
9110 * C++ Semantic Values:: %union vs. C++
9117 File: bison.info, Node: C++ Bison Interface, Next: C++ Semantic Values, Up: C++ Parsers
9155 File: bison.info, Node: C++ Semantic Values, Next: C++ Location Values, Prev: C++ Bison Interface, Up: C++ Parsers
9157 10.1.2 C++ Semantic Values
9182 File: bison.info, Node: C++ Location Values, Next: C++ Parser Interface, Prev: C++ Semantic Values, Up: C++ Parsers
9409 Return the next token. Its type is the return value, its semantic
9628 Semantic values cannot use "real" objects, but only pointers to them.
9842 * Java Semantic Values:: %type and %token vs. Java
9851 File: bison.info, Node: Java Bison Interface, Next: Java Semantic Values, Up: Java Parsers
9897 File: bison.info, Node: Java Semantic Values, Next: Java Location Values, Prev: Java Bison Interface, Up: Java Parsers
9899 10.2.2 Java Semantic Values
9902 There is no `%union' directive in Java parsers. Instead, the semantic
9909 By default, the semantic stack is declared to have `Object' members,
9912 superclass of all the semantic values using the `%define stype'
9917 any `%type' or `%token' specifying a semantic type which is not a
9927 garbage collection. The parser will try to hold references to semantic
9931 to print the semantic values. This however may change (in a
9935 File: bison.info, Node: Java Location Values, Next: Java Parser Interface, Prev: Java Semantic Values, Up: Java Parsers
10072 Return the next token. Its type is the return value, its semantic
10089 Return the semantic value of the last token that yylex returned.
10106 The semantic value for the Nth component of the current rule.
10107 This may not be assigned to. *Note Java Semantic Values::.
10111 Semantic Values::.
10114 The semantic value for the grouping made by the current rule. As a
10119 Java Semantic Values::.
10125 these constructs. *Note Java Semantic Values::.
10179 * Java lacks unions, so `%union' has no effect. Instead, semantic
10186 *Note Java Semantic Values::, and *note Java Action Features::.
10249 _type_. *Note Java Semantic Values::.
10253 enclose a Java _type_. *Note Java Semantic Values::.
10320 The base type of semantic values. Default is `Object'. *Note
10321 Java Semantic Values::.
10730 In an action, the semantic value of the left-hand side of the rule.
10734 In an action, the semantic value of the N-th symbol of the
10739 In an action, the semantic value of a symbol addressed by NAME.
10869 merging function, the function is applied to the two semantic
10951 semantic values. *Note The Collection of Value Types: Union Decl.
11044 Locations. In semantic actions, it stores the location of the
11053 External variable in which `yylex' should place the semantic value
11056 *Note Semantic Values of Tokens: Token Values. In semantic
11057 actions, it stores the semantic value of the lookahead token.
11075 Macro used to output token semantic values. For `yacc.c' only.
11136 Data type of semantic values; `int' by default. *Note Data Types
11137 of Semantic Values: Value Type.
11231 detection results in unexpected semantic actions, initiation of
12149 * actions, semantic: Semantic Actions. (line 6)
12218 * data types of semantic values: Value Type. (line 6)
12242 * deferred semantic actions: GLR Semantic Actions.
12304 * GLR parsers and yychar: GLR Semantic Actions.
12306 * GLR parsers and yyclearin: GLR Semantic Actions.
12308 * GLR parsers and YYERROR: GLR Semantic Actions.
12310 * GLR parsers and yylloc: GLR Semantic Actions.
12314 * GLR parsers and yylval: GLR Semantic Actions.
12459 * printing semantic values: Printer Decl. (line 6)
12488 * semantic actions: Semantic Actions. (line 6)
12489 * semantic value: Semantic Values. (line 6)
12490 * semantic value type: Value Type. (line 6)
12549 * value type, semantic: Value Type. (line 6)
12552 * value, semantic: Semantic Values. (line 6)
12571 * yychar <2>: GLR Semantic Actions.
12575 * yyclearin <1>: GLR Semantic Actions.
12599 * YYERROR: GLR Semantic Actions.
12617 * yylloc <1>: GLR Semantic Actions.
12633 * yylval <5>: GLR Semantic Actions.
12681 Node: Semantic Values65271
12682 Node: Semantic Actions67377
12686 Node: GLR Semantic Actions82251
12792 Node: Semantic Tokens317165
12810 Node: C++ Semantic Values368793
12811 Ref: C++ Semantic Values-Footnote-1369735
12826 Node: Java Semantic Values394847