Home | History | Annotate | Download | only in doc

Lines Matching full:semantic

123 * Semantic Values::      Each token or syntactic grouping can have
124 a semantic value (the value of an integer,
126 * Semantic Actions:: Each rule can have an action containing C code.
138 * GLR Semantic Actions:: Deferred semantic actions have special concerns.
150 It uses multiple data-types for semantic values.
187 * Semantics:: Semantic values and actions.
203 * Value Type:: Specifying one data type for all semantic values.
205 * Actions:: An action is the semantic definition of a grammar rule.
228 * Union Decl:: Declaring the set of all semantic value types.
258 * Token Values:: How @code{yylex} must return the semantic value
296 * Semantic Tokens:: Token parsing can depend on the semantic context.
312 * The YYPRINT Macro:: Obsolete interface for semantic value reports
329 * C++ Semantic Values:: %union vs. C++
352 * Java Semantic Values:: %type and %token vs. Java
469 * Semantic Values:: Each token or syntactic grouping can have
470 a semantic value (the value of an integer,
472 * Semantic Actions:: Each rule can have an action containing C code.
657 @node Semantic Values
658 @section Semantic Values
659 @cindex semantic value
660 @cindex value, semantic
672 has both a token type and a @dfn{semantic value}. @xref{Semantics,
682 The semantic value has all the rest of the information about the
685 need to have any semantic value.)
688 @code{INTEGER} and have the semantic value 4. Another input token might
692 token, it keeps track of the token's semantic value.
694 Each grouping can also have a semantic value as well as its nonterminal
696 semantic value that is a number. In a compiler for a programming
697 language, an expression typically has a semantic value that is a tree
700 @node Semantic Actions
701 @section Semantic Actions
702 @cindex semantic actions
703 @cindex actions, semantic
711 Most of the time, the purpose of an action is to compute the semantic value
712 of the whole construct from the semantic values of its parts. For example,
715 subexpressions has a semantic value which describes how it was built up.
727 The action says how to produce the semantic value of the sum expression
768 During the time that there are multiple parsers, semantic actions are
770 semantic actions disappear as well, and are never performed. When a
772 records both sets of semantic actions. Whenever the last two parsers
782 * GLR Semantic Actions:: Deferred semantic actions have special concerns.
845 contortions in both semantic actions and large parts of the
964 conflict. Second, consider interactions with the lexer (@pxref{Semantic
1098 the possibilities. For this purpose, you must merge the semantic
1147 @node GLR Semantic Actions
1148 @subsection GLR Semantic Actions
1150 @cindex deferred semantic actions
1151 By definition, a deferred semantic action is not performed at the same time as
1153 This raises caveats for several Bison features you might use in a semantic
1162 In any semantic action, you can examine @code{yychar} to determine the type of
1166 lookahead token's semantic value and location, if any.
1167 In a nondeferred semantic action, you can also modify any of these variables to
1173 In a deferred semantic action, it's too late to influence syntax analysis.
1179 For example, if a semantic action might be deferred, you should never write it
1186 (@pxref{Action Features}), which you can invoke in a semantic action to
1190 In a deferred semantic action, its effect is undefined.
1237 Each token has a semantic value. In a similar fashion, each token has an
1243 Like semantic values, locations can be reached in actions using a dedicated
1248 When a rule is matched, a default action is used to compute the semantic value
1280 doesn't know what is ``inside'' the tokens (though their semantic values
1396 semantic values of various symbols.
1428 It uses multiple data-types for semantic values.
1482 specifying the C data type for semantic values of both tokens and
1483 groupings (@pxref{Value Type, ,Data Types of Semantic Values}). The
1553 passing semantic values between the rules. In each action, the
1554 pseudo-variable @code{$$} stands for the semantic value for the grouping
1556 main job of most actions. The semantic values of the components of the
1615 This is the alternative that makes rpcalc useful. The semantic value of
1621 a consequence, the semantic value associated with the @code{line} is
1657 associated semantic value, but if it had one you could refer to it as
1715 The semantic value of the token (if it has one) is stored into the
2146 This code shows how to reach locations inside of semantic actions, by
2164 semantic values.
2229 as well as its semantic value, and its location in the text. The last
2337 These features allow semantic values to have various data types
2346 type with each grammar symbol whose semantic value is used. These symbols
2722 * Semantics:: Semantic values and actions.
3087 For example, you may organize semantic-type-related directives by semantic
3108 the grammar file next to the set of rules that uses the associated semantic
3221 specify its semantic value data type (@pxref{Value Type, ,Data Types of
3222 Semantic Values}), associativity, or precedence (@pxref{Precedence,
3245 doesn't need to be declared unless you need to specify its semantic
3504 are determined by the semantic values associated with various tokens and
3513 * Value Type:: Specifying one data type for all semantic values.
3515 * Actions:: An action is the semantic definition of a grammar rule.
3523 @subsection Data Types of Semantic Values
3524 @cindex semantic value type
3525 @cindex value type, semantic
3526 @cindex data types of semantic values
3530 the semantic values of all language constructs. This was true in the
3534 Bison normally uses the type @code{int} for semantic values if your
3557 To use more than one data type for semantic values in one parser, Bison
3570 which semantic values are used. This is done for tokens with the
3586 is to compute a semantic value for the grouping built by the rule from the
3587 semantic values associated with tokens or smaller groupings.
3596 The C code in an action can refer to the semantic values of the
3598 which stands for the value of the @var{n}th component. The semantic
3600 the semantic values of symbols can be accessed with the named
3632 refer to the semantic values of the two component @code{exp} groupings,
3635 semantic value of
3637 useful semantic value associated with the @samp{+} token, it could be
3689 It is also possible to access the semantic value of the lookahead token, if
3690 any, from a semantic action.
3691 This semantic value is stored in @code{yylval}.
3699 If you have chosen a single data type for semantic values, the @code{$$}
3704 symbol that can have a semantic value. Then each time you use @code{$$} or
3767 The mid-rule action can also have a semantic value. The action can set
3804 action is run. It saves a copy of the current semantic context (the
3805 list of accessible variables) as its semantic value, using alternative
3831 After the embedded statement is parsed, its semantic value becomes the
3832 value of the entire @code{let}-statement. Then the semantic value from the
3842 it might discard the previous semantic context @code{$<context>5} without
3847 a particular mid-rule action's semantic value.
4055 Though grammar rules and semantic actions are enough to write a fully
4073 Defining a data type for locations is much simpler than for semantic values,
4077 @code{YYLTYPE}, just as you can specify the semantic value type by
4111 similar to the way semantic values are computed. In a given rule, several
4148 As for semantic values, there is a default action for locations that is
4178 from a semantic action.
4188 locations are much more general than semantic values, there is room in
4198 dedicated code from semantic actions.
4248 For consistency with semantic actions, valid indexes within the
4265 semantic value or location is a @dfn{positional reference}, which takes the
4271 To avoid these issues, you can also refer to a semantic value or location
4321 In order to access a semantic value generated by a mid-rule action, an
4345 @samp{.suffix}, i.e., an access to the @code{suffix} field of the semantic
4347 entirety as the name of a semantic value, the bracketed syntax
4359 used in formulating the grammar and the data types of semantic values.
4364 declared if you need to specify which data type to use for the semantic
4376 * Union Decl:: Declaring the set of all semantic value types.
4560 possible data types for semantic values. The keyword @code{%union} is
4714 designates the semantic value associated with the discarded symbol, and
4721 You may also define a per-type @code{%destructor} by listing a semantic type
4724 grammar symbol that has that semantic type tag unless that symbol has its own
4737 symbol for which you have formally declared a semantic type tag (@code{%type}
4740 symbol that has no declared semantic type tag.
4765 semantic type tag other than @code{<character>}, it passes its semantic value
4772 such as @code{TAGLESS}, that has no semantic type tag.
4793 mid-rule semantic value (@pxref{Mid-Rule Actions,,Actions in Mid-Rule}).
4794 That is, Bison does not consider a mid-rule to have a semantic value if you
4839 @subsection Printing Semantic Values
4840 @cindex printing semantic values
4847 know how semantic values should be formatted.
4860 @code{$<@var{tag}>$}) designates the semantic value associated with the
4893 guarantees that, when the parser print any symbol that has a semantic type
4894 tag other than @code{<character>}, it display the address of the semantic
4899 that has no semantic type tag. See also
5138 Declare the collection of data types that semantic values may have
5171 Declare the type of semantic values for a nonterminal symbol
5225 Type, ,Data Types of Semantic Values}), you need to arrange for these
5242 Values, ,Semantic Values of Tokens}.
6079 * Token Values:: How @code{yylex} must return the semantic value
6170 @subsection Semantic Values of Tokens
6173 In an ordinary (nonreentrant) parser, the semantic value of the token must
6175 just one data type for semantic values, @code{yylval} has that type.
6391 Acts like a variable that contains the semantic value for the
6396 Acts like a variable that contains the semantic value for the
6428 semantic value @var{value}; then it discards the value that was
6467 Do not modify @code{yychar} in a deferred semantic action (@pxref{GLR Semantic
6475 Do not invoke @code{yyclearin} in a deferred semantic action (@pxref{GLR
6476 Semantic Actions}).
6489 Do not modify @code{yylloc} in a deferred semantic action (@pxref{GLR Semantic
6495 Variable containing the lookahead token semantic value when @code{yychar} is
6497 Do not modify @code{yylval} in a deferred semantic action (@pxref{GLR Semantic
6628 semantic values. The stack is called the @dfn{parser stack}. Pushing a
6641 is what computes the semantic value of the resulting grouping.
6744 Its semantic value and location, if any, are stored in the variables
7615 @code{yylex} can influence or be influenced by the semantic actions
7618 For example, the semantic actions might pop a scope stack that @code{yylex}
7689 reductions can perform user semantic actions that are unexpected because
7722 During this exploratory parse, the parser does not perform user semantic
7777 semantic actions, but none of these are performed during the exploratory
7871 immediately. When a stack disappears, its saved semantic actions never
7873 their sets of semantic actions are both saved with the state that
7883 At this transition, some of the states on the stack will have semantic
7961 Because of semantic differences between C and C++, the deterministic
8015 the semantic context and part of the input. First it discards states
8100 * Semantic Tokens:: Token parsing can depend on the semantic context.
8109 @node Semantic Tokens
8110 @section Semantic Info in Token Types
8934 * The YYPRINT Macro:: Obsolete interface for semantic value reports
9023 but not its semantic value. The @code{%printer} directive allows specify
9024 how semantic values are reported, see @ref{Printer Decl, , Printing
9025 Semantic Values}. For backward compatibility, Yacc like C parsers may also
9031 traces, and semantic value reports, insert the following directives in its
9041 /* Formatting semantic values. */
9055 semantic value in the traces. Note that the specification can be done
9192 Before @code{%printer} support, semantic values could be displayed using the
9659 * C++ Semantic Values:: %union vs. C++
9709 @node C++ Semantic Values
9710 @subsection C++ Semantic Values
9995 Return the next token. Its type is the return value, its semantic
10260 Semantic values cannot use ``real'' objects, but only pointers to
10531 * Java Semantic Values:: %type and %token vs. Java
10588 @node Java Semantic Values
10589 @subsection Java Semantic Values
10595 semantic values' types (class names) should be specified in the
10603 By default, the semantic stack is declared to have @code{Object} members,
10606 superclass of all the semantic values using the @code{%define stype}
10614 any @code{%type} or @code{%token} specifying a semantic type which
10626 to semantic values for as little time as needed.
10629 can be used to print the semantic values. This however may change
10788 Return the next token. Its type is the return value, its semantic
10807 Return the semantic value of the last token that yylex returned.
10824 The semantic value for the @var{n}th component of the current rule.
10826 @xref{Java Semantic Values}.
10831 @xref{Java Semantic Values}.
10835 The semantic value for the grouping made by the current rule. As a
10840 @xref{Java Semantic Values}.
10848 @xref{Java Semantic Values}.
10916 Java lacks unions, so @code{%union} has no effect. Instead, semantic
10923 left-hand side of assignments. @xref{Java Semantic Values}, and
10985 @xref{Java Semantic Values}.
10991 @xref{Java Semantic Values}.
11079 The base type of semantic values. Default is @code{Object}.
11080 @xref{Java Semantic Values}.
11532 In an action, the semantic value of the left-hand side of the rule.
11537 In an action, the semantic value of the @var{n}-th symbol of the
11543 In an action, the semantic value of a symbol addressed by @var{name}.
11708 function is applied to the two semantic values to get a single result.
11813 Bison declaration to specify several possible data types for semantic
11926 In semantic actions, it stores the location of the lookahead token.
11936 External variable in which @code{yylex} should place the semantic
11940 @xref{Token Values, ,Semantic Values of Tokens}.
11941 In semantic actions, it stores the semantic value of the lookahead token.
11963 Macro used to output token semantic values. For @file{yacc.c} only.
12034 Data type of semantic values; @code{int} by default.
12035 @xref{Value Type, ,Data Types of Semantic Values}.
12126 unexpected semantic actions, initiation of error recovery in the wrong