nonterminal_attributes.html 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  4. <title>Attributes of Nonterminals</title>
  5. <link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
  6. <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
  7. <link rel="home" href="../../index.html" title="Spirit X3 3.0.4">
  8. <link rel="up" href="../abstracts.html" title="Abstracts">
  9. <link rel="prev" href="more_compound_attributes.html" title="More About Attributes of Compound Components">
  10. <link rel="next" href="../tutorials.html" title="Tutorials">
  11. </head>
  12. <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
  13. <table cellpadding="2" width="100%"><tr>
  14. <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
  15. <td align="center"><a href="../../../../../../../index.html">Home</a></td>
  16. <td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
  17. <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
  18. <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
  19. <td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
  20. </tr></table>
  21. <hr>
  22. <div class="spirit-nav">
  23. <a accesskey="p" href="more_compound_attributes.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../tutorials.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
  24. </div>
  25. <div class="section">
  26. <div class="titlepage"><div><div><h3 class="title">
  27. <a name="spirit_x3.abstracts.nonterminal_attributes"></a><a class="link" href="nonterminal_attributes.html" title="Attributes of Nonterminals">Attributes
  28. of Nonterminals</a>
  29. </h3></div></div></div>
  30. <p>
  31. Nonterminals are the main means of constructing more complex parsers out
  32. of simpler ones. The nonterminals in the parser world are very similar to
  33. functions in an imperative programming language. They can be used to encapsulate
  34. parser expressions for a particular input sequence. After being defined,
  35. the nonterminals can be used as 'normal' parsers in more complex expressions
  36. whenever the encapsulated input needs to be recognized. Parser nonterminals
  37. in <span class="emphasis"><em>Spirit.X3</em></span> usually return a value (the synthesized
  38. attribute).
  39. </p>
  40. <p>
  41. The type of the synthesized attribute as to be explicitly specified while
  42. defining the particular nonterminal. Example (ignore ID for now):
  43. </p>
  44. <pre class="programlisting"><span class="identifier">x3</span><span class="special">::</span><span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">ID</span><span class="special">,</span> <span class="keyword">int</span><span class="special">&gt;</span> <span class="identifier">r</span><span class="special">;</span>
  45. </pre>
  46. </div>
  47. <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
  48. <td align="left"></td>
  49. <td align="right"><div class="copyright-footer">Copyright &#169; 2001-2018 Joel de Guzman,
  50. Hartmut Kaiser<p>
  51. Distributed under the Boost Software License, Version 1.0. (See accompanying
  52. file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
  53. </p>
  54. </div></td>
  55. </tr></table>
  56. <hr>
  57. <div class="spirit-nav">
  58. <a accesskey="p" href="more_compound_attributes.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../tutorials.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
  59. </div>
  60. </body>
  61. </html>