bison.info-5 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. This is Info file bison.info, produced by Makeinfo-1.55 from the input
  2. file bison.texinfo.
  3. This file documents the Bison parser generator.
  4. Copyright (C) 1988, 1989, 1990, 1991, 1992 Free Software Foundation,
  5. Inc. Modified (1993) from bison-1.22 by Wilfred J. Hansen
  6. (wjh+@cmu.edu), Andrew Consortium, Carnegie Mellon University
  7. CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
  8. THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  9. FITNESS. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE FOR ANY
  10. SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
  11. RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
  12. CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  13. CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  14. Permission is granted to make and distribute verbatim copies of this
  15. manual provided the copyright notice and this permission notice are
  16. preserved on all copies.
  17. Permission is granted to copy and distribute modified versions of
  18. this manual under the conditions for verbatim copying, provided also
  19. that the sections entitled "GNU General Public License" and "Conditions
  20. for Using Bison" are included exactly as in the original, and provided
  21. that the entire resulting derived work is distributed under the terms
  22. of a permission notice identical to this one.
  23. Permission is granted to copy and distribute translations of this
  24. manual into another language, under the above conditions for modified
  25. versions, except that the sections entitled "GNU General Public
  26. License", "Conditions for Using Bison" and this permission notice may be
  27. included in translations approved by the Free Software Foundation
  28. instead of in the original English.
  29. 
  30. File: bison.info, Node: Glossary, Next: Index, Prev: Parser Symbols, Up: Top
  31. Glossary
  32. ********
  33. Backus-Naur Form (BNF)
  34. Formal method of specifying context-free grammars. BNF was first
  35. used in the `ALGOL-60' report, 1963. *Note Languages and
  36. Context-Free Grammars: Language and Grammar.
  37. Context-free grammars
  38. Grammars specified as rules that can be applied regardless of
  39. context. Thus, if there is a rule which says that an integer can
  40. be used as an expression, integers are allowed *anywhere* an
  41. expression is permitted. *Note Languages and Context-Free
  42. Grammars: Language and Grammar.
  43. Dynamic allocation
  44. Allocation of memory that occurs during execution, rather than at
  45. compile time or on entry to a function.
  46. Empty string
  47. Analogous to the empty set in set theory, the empty string is a
  48. character string of length zero.
  49. Finite-state stack machine
  50. A "machine" that has discrete states in which it is said to exist
  51. at each instant in time. As input to the machine is processed, the
  52. machine moves from state to state as specified by the logic of the
  53. machine. In the case of the parser, the input is the language
  54. being parsed, and the states correspond to various stages in the
  55. grammar rules. *Note The Bison Parser Algorithm: Algorithm.
  56. Grouping
  57. A language construct that is (in general) grammatically divisible;
  58. for example, `expression' or `declaration' in C. *Note Languages
  59. and Context-Free Grammars: Language and Grammar.
  60. Infix operator
  61. An arithmetic operator that is placed between the operands on
  62. which it performs some operation.
  63. Input stream
  64. A continuous flow of data between devices or programs.
  65. Language construct
  66. One of the typical usage schemas of the language. For example,
  67. one of the constructs of the C language is the `if' statement.
  68. *Note Languages and Context-Free Grammars: Language and Grammar.
  69. Left associativity
  70. Operators having left associativity are analyzed from left to
  71. right: `a+b+c' first computes `a+b' and then combines with `c'.
  72. *Note Operator Precedence: Precedence.
  73. Left recursion
  74. A rule whose result symbol is also its first component symbol; for
  75. example, `expseq1 : expseq1 ',' exp;'. *Note Recursive Rules:
  76. Recursion.
  77. Left-to-right parsing
  78. Parsing a sentence of a language by analyzing it token by token
  79. from left to right. *Note The Bison Parser Algorithm: Algorithm.
  80. Lexical analyzer (scanner)
  81. A function that reads an input stream and returns tokens one by
  82. one. *Note The Lexical Analyzer Function `yylex': Lexical.
  83. Lexical tie-in
  84. A flag, set by actions in the grammar rules, which alters the way
  85. tokens are parsed. *Note Lexical Tie-ins::.
  86. Look-ahead token
  87. A token already read but not yet shifted. *Note Look-Ahead
  88. Tokens: Look-Ahead.
  89. LALR(1)
  90. The class of context-free grammars that Bison (like most other
  91. parser generators) can handle; a subset of LR(1). *Note
  92. Mysterious Reduce/Reduce Conflicts: Mystery Conflicts.
  93. LR(1)
  94. The class of context-free grammars in which at most one token of
  95. look-ahead is needed to disambiguate the parsing of any piece of
  96. input.
  97. Nonterminal symbol
  98. A grammar symbol standing for a grammatical construct that can be
  99. expressed through rules in terms of smaller constructs; in other
  100. words, a construct that is not a token. *Note Symbols - Terminal
  101. and Nonterminal: Symbols.
  102. Parse error
  103. An error encountered during parsing of an input stream due to
  104. invalid syntax. *Note Error Recovery::.
  105. Parser
  106. A function that recognizes valid sentences of a language by
  107. analyzing the syntax structure of a set of tokens passed to it
  108. from a lexical analyzer.
  109. Postfix operator
  110. An arithmetic operator that is placed after the operands upon
  111. which it performs some operation.
  112. Reduction
  113. Replacing a string of nonterminals and/or terminals with a single
  114. nonterminal, according to a grammar rule. *Note The Bison Parser
  115. Algorithm: Algorithm.
  116. Reentrant
  117. A reentrant subprogram is a subprogram which can be in invoked any
  118. number of times in parallel, without interference between the
  119. various invocations. *Note A Pure (Reentrant) Parser: Pure Decl.
  120. Reverse polish notation
  121. A language in which all operators are postfix operators.
  122. Right recursion
  123. A rule whose result symbol is also its last component symbol; for
  124. example, `expseq1: exp ',' expseq1;'. *Note Recursive Rules:
  125. Recursion.
  126. Semantics
  127. In computer languages, the semantics are specified by the actions
  128. taken for each instance of the language, i.e., the meaning of each
  129. statement. *Note Defining Language Semantics: Semantics.
  130. Shift
  131. A parser is said to shift when it makes the choice of analyzing
  132. further input from the stream rather than reducing immediately some
  133. already-recognized rule. *Note The Bison Parser Algorithm:
  134. Algorithm.
  135. Single-character literal
  136. A single character that is recognized and interpreted as is.
  137. *Note From Formal Rules to Bison Input: Grammar in Bison.
  138. Start symbol
  139. The nonterminal symbol that stands for a complete valid utterance
  140. in the language being parsed. The start symbol is usually listed
  141. as the first nonterminal symbol in a language specification.
  142. *Note The Start-Symbol: Start Decl.
  143. Symbol table
  144. A data structure where symbol names and associated data are stored
  145. during parsing to allow for recognition and use of existing
  146. information in repeated uses of a symbol. *Note Multi-function
  147. Calc::.
  148. Token
  149. A basic, grammatically indivisible unit of a language. The symbol
  150. that describes a token in the grammar is a terminal symbol. The
  151. input of the Bison parser is a stream of tokens which comes from
  152. the lexical analyzer. *Note Symbols - Terminal and Nonterminal:
  153. Symbols.
  154. Terminal symbol
  155. A grammar symbol that has no rules in the grammar and therefore is
  156. grammatically indivisible. The piece of text it represents is a
  157. token. *Note Languages and Context-Free Grammars: Language and
  158. Grammar.
  159. 
  160. File: bison.info, Node: Index, Prev: Glossary, Up: Top
  161. Index
  162. *****
  163. * Menu:
  164. * $$: Actions.
  165. * $N: Actions.
  166. * %expect: Expect Decl.
  167. * %left: Using Precedence.
  168. * %nonassoc: Using Precedence.
  169. * %prec: Contextual Precedence.
  170. * %pure_parser: Pure Decl.
  171. * %right: Using Precedence.
  172. * %start: Start Decl.
  173. * %token: Token Decl.
  174. * %type: Type Decl.
  175. * %union: Union Decl.
  176. * @N: Action Features.
  177. * calc: Infix Calc.
  178. * else, dangling: Shift/Reduce.
  179. * mfcalc: Multi-function Calc.
  180. * rpcalc: RPN Calc.
  181. * action: Actions.
  182. * action data types: Action Types.
  183. * action features summary: Action Features.
  184. * actions in mid-rule: Mid-Rule Actions.
  185. * actions, semantic: Semantic Actions.
  186. * additional C code section: C Code.
  187. * algorithm of parser: Algorithm.
  188. * associativity: Why Precedence.
  189. * Backus-Naur form: Language and Grammar.
  190. * Bison declaration summary: Decl Summary.
  191. * Bison declarations: Declarations.
  192. * Bison declarations (introduction): Bison Declarations.
  193. * Bison grammar: Grammar in Bison.
  194. * Bison invocation: Invocation.
  195. * Bison parser: Bison Parser.
  196. * Bison parser algorithm: Algorithm.
  197. * Bison symbols, table of: Table of Symbols.
  198. * Bison utility: Bison Parser.
  199. * BNF: Language and Grammar.
  200. * C code, section for additional: C Code.
  201. * C declarations section: C Declarations.
  202. * C-language interface: Interface.
  203. * calculator, infix notation: Infix Calc.
  204. * calculator, multi-function: Multi-function Calc.
  205. * calculator, simple: RPN Calc.
  206. * character token: Symbols.
  207. * compiling the parser: Rpcalc Compile.
  208. * conflicts: Shift/Reduce.
  209. * conflicts, reduce/reduce: Reduce/Reduce.
  210. * conflicts, suppressing warnings of: Expect Decl.
  211. * context-dependent precedence: Contextual Precedence.
  212. * context-free grammar: Language and Grammar.
  213. * controlling function: Rpcalc Main.
  214. * dangling else: Shift/Reduce.
  215. * data types in actions: Action Types.
  216. * data types of semantic values: Value Type.
  217. * debugging: Debugging.
  218. * declaration summary: Decl Summary.
  219. * declarations, Bison: Declarations.
  220. * declarations, Bison (introduction): Bison Declarations.
  221. * declarations, C: C Declarations.
  222. * declaring operator precedence: Precedence Decl.
  223. * declaring string literal tokens: Thong Decl.
  224. * declaring the start symbol: Start Decl.
  225. * declaring thongs: Thong Decl.
  226. * declaring token type names: Token Decl.
  227. * declaring value types: Union Decl.
  228. * declaring value types, nonterminals: Type Decl.
  229. * default action: Actions.
  230. * default data type: Value Type.
  231. * default stack limit: Stack Overflow.
  232. * default start symbol: Start Decl.
  233. * defining language semantics: Semantics.
  234. * error: Error Recovery.
  235. * error recovery: Error Recovery.
  236. * error recovery, simple: Simple Error Recovery.
  237. * error reporting function: Error Reporting.
  238. * error reporting routine: Rpcalc Error.
  239. * examples, simple: Examples.
  240. * exercises: Exercises.
  241. * file format: Grammar Layout.
  242. * finite-state machine: Parser States.
  243. * formal grammar: Grammar in Bison.
  244. * format of grammar file: Grammar Layout.
  245. * glossary: Glossary.
  246. * grammar file: Grammar Layout.
  247. * grammar rule syntax: Rules.
  248. * grammar rules section: Grammar Rules.
  249. * grammar, Bison: Grammar in Bison.
  250. * grammar, context-free: Language and Grammar.
  251. * grouping, syntactic: Language and Grammar.
  252. * infix notation calculator: Infix Calc.
  253. * interface: Interface.
  254. * introduction: Introduction.
  255. * invoking Bison: Invocation.
  256. * invoking Bison under VMS: VMS Invocation.
  257. * LALR(1): Mystery Conflicts.
  258. * language semantics, defining: Semantics.
  259. * layout of Bison grammar: Grammar Layout.
  260. * left recursion: Recursion.
  261. * lexical analyzer: Lexical.
  262. * lexical analyzer, purpose: Bison Parser.
  263. * lexical analyzer, writing: Rpcalc Lexer.
  264. * lexical tie-in: Lexical Tie-ins.
  265. * literal string token: Symbols.
  266. * literal token: Symbols.
  267. * look-ahead token: Look-Ahead.
  268. * LR(1): Mystery Conflicts.
  269. * main function in simple example: Rpcalc Main.
  270. * mid-rule actions: Mid-Rule Actions.
  271. * multi-character terminal symbols: Thong Decl.
  272. * multi-function calculator: Multi-function Calc.
  273. * multiple-character literal: Symbols.
  274. * mutual recursion: Recursion.
  275. * nonterminal symbol: Symbols.
  276. * operator precedence: Precedence.
  277. * operator precedence, declaring: Precedence Decl.
  278. * options for invoking Bison: Invocation.
  279. * overflow of parser stack: Stack Overflow.
  280. * parse error: Error Reporting.
  281. * parser: Bison Parser.
  282. * parser stack: Algorithm.
  283. * parser stack overflow: Stack Overflow.
  284. * parser state: Parser States.
  285. * polish notation calculator: RPN Calc.
  286. * precedence declarations: Precedence Decl.
  287. * precedence of operators: Precedence.
  288. * precedence, context-dependent: Contextual Precedence.
  289. * precedence, unary operator: Contextual Precedence.
  290. * preventing warnings about conflicts: Expect Decl.
  291. * pure parser: Pure Decl.
  292. * recovery from errors: Error Recovery.
  293. * recursive rule: Recursion.
  294. * reduce/reduce conflict: Reduce/Reduce.
  295. * reduction: Algorithm.
  296. * reentrant parser: Pure Decl.
  297. * reverse polish notation: RPN Calc.
  298. * right recursion: Recursion.
  299. * rule syntax: Rules.
  300. * rules section for grammar: Grammar Rules.
  301. * running Bison (introduction): Rpcalc Gen.
  302. * semantic actions: Semantic Actions.
  303. * semantic value: Semantic Values.
  304. * semantic value type: Value Type.
  305. * shift/reduce conflicts: Shift/Reduce.
  306. * shifting: Algorithm.
  307. * simple examples: Examples.
  308. * single-character literal: Symbols.
  309. * stack overflow: Stack Overflow.
  310. * stack, parser: Algorithm.
  311. * stages in using Bison: Stages.
  312. * start symbol: Language and Grammar.
  313. * start symbol, declaring: Start Decl.
  314. * state (of parser): Parser States.
  315. * string token: Symbols.
  316. * summary, action features: Action Features.
  317. * summary, Bison declaration: Decl Summary.
  318. * suppressing conflict warnings: Expect Decl.
  319. * symbol: Symbols.
  320. * symbol table example: Mfcalc Symtab.
  321. * symbols (abstract): Language and Grammar.
  322. * symbols in Bison, table of: Table of Symbols.
  323. * symbols, parser: Parser Symbols.
  324. * syntactic grouping: Language and Grammar.
  325. * syntax error: Error Reporting.
  326. * syntax of grammar rules: Rules.
  327. * terminal symbol: Symbols.
  328. * thong declarations: Thong Decl.
  329. * token: Language and Grammar.
  330. * token type: Symbols.
  331. * token type names, declaring: Token Decl.
  332. * tracing the parser: Debugging.
  333. * unary operator precedence: Contextual Precedence.
  334. * using Bison: Stages.
  335. * value type, semantic: Value Type.
  336. * value types, declaring: Union Decl.
  337. * value types, nonterminals, declaring: Type Decl.
  338. * value, semantic: Semantic Values.
  339. * VMS: VMS Invocation.
  340. * warnings, preventing: Expect Decl.
  341. * writing a lexical analyzer: Rpcalc Lexer.
  342. * YYABORT: Parser Function.
  343. * YYACCEPT: Parser Function.
  344. * YYBACKUP: Action Features.
  345. * yychar: Look-Ahead.
  346. * yyclearin: Error Recovery.
  347. * YYDEBUG: Debugging.
  348. * yydebug: Debugging.
  349. * YYEMPTY: Action Features.
  350. * yyerrok: Error Recovery.
  351. * YYERROR: Action Features.
  352. * yyerror: Error Reporting.
  353. * YYERROR_VERBOSE: Error Reporting.
  354. * YYINITDEPTH: Stack Overflow.
  355. * yylex: Lexical.
  356. * yylloc: Token Positions.
  357. * YYLTYPE: Token Positions.
  358. * yylval: Token Values.
  359. * YYMAXDEPTH: Stack Overflow.
  360. * yynerrs: Error Reporting.
  361. * yyparse: Parser Function.
  362. * YYPRINT: Debugging.
  363. * YYRECOVERING: Error Recovery.
  364. * |: Rules.