This file is indexed.

/usr/share/doc/camlp5/html/ml_ast.html is in camlp5 7.01-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <!-- ml_ast.html,v -->
  <!-- Copyright (c) INRIA 2007-2017 -->
  <title>Abstract tree in concrete syntax</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <link rel="stylesheet" type="text/css" href="styles/base.css"
        title="Normal" />
  <link rel="alternate" type="application/rss+xml" href="rss/camlp5.rss" 
        title="Camlp5"/>
  <style type="text/css"><!--
    table { margin-left: 1cm }
    td { padding-right: 2mm }
  --></style>
</head>
<body>

<div id="menu">
  <h1>- <a href="http://pauillac.inria.fr/~ddr/camlp5">Camlp5</a> -</h1>
  <p class="subtitle">Version 7.01</p>
  <ul>
    <li><a href="index.html">Introduction</a></li>
    <li><a href="strict.html">Transitional and Strict</a></li>
    <li><a href="ptools.html">Parsing and printing tools</a></li>
  </ul>
  <ul>
    <li>Parsing tools
      <ul>
        <li><a href="parsers.html">Stream parsers</a></li>
        <li><a href="lexers.html">Stream lexers</a></li>
        <li><a href="fparsers.html">Functional parsers</a></li>
        <li><a href="bparsers.html">Backtracking parsers</a></li>
        <li><a href="grammars.html">Extensible grammars</a></li>
      </ul>
    </li>
    <li>Printing tools
      <ul>
        <li><a href="printers.html">Extensible printers</a></li>
        <li><a href="pprintf.html">Pprintf</a></li>
        <li><a href="pretty.html">Pretty print</a></li>
      </ul>
    </li>
    <li>Language extensions
      <ul>
        <li><a href="locations.html">Locations</a></li>
        <li><a href="ml_ast.html">Syntax tree</a></li>
        <li><a href="ast_transi.html">Syntax tree - transi</a></li>
        <li><a href="ast_strict.html">Syntax tree - strict</a></li>
        <li><a href="q_ast.html">Quotation kit q_ast.cmo</a></li>
        <li><a href="pcaml.html">The Pcaml module</a></li>
        <li><a href="directives.html">Directives</a></li>
        <li><a href="syntext.html">Extensions of syntax</a></li>
        <li><a href="opretty.html">Extensions of printing</a></li>
        <li><a href="redef.html">Redefining OCaml syntax</a></li>
        <li><a href="quot.html">Quotations</a></li>
        <li><a href="revsynt.html">Revised syntax</a></li>
        <li><a href="scheme.html">Scheme syntax</a></li>
        <li><a href="macros.html">Macros</a></li>
        <li><a href="pragma.html">Pragma directive</a></li>
        <li><a href="extfun.html">Extensible functions</a></li>
      </ul>
    </li>
    <li>Appendix
      <ul>
        <li><a href="commands.html">Commands and Files</a></li>
        <li><a href="library.html">Library</a></li>
        <li><a href="sources.html">Camlp5 sources</a></li>
        <li><a href="about.html">About Camlp5</a></li>
      </ul>
    </li>
  </ul>
</div>

<div id="content">

<h1 class="top">Syntax tree</h1>

<p>In Camlp5, one often uses syntax trees. For example, in grammars of
  the language (semantic actions), in pretty printing (as patterns),
  in optimizing syntax code (typically stream parsers). Syntax trees
  are mainly defined by sum types, one for each kind of tree:
  "<tt>expr</tt>" for expressions, "<tt>patt</tt>" for patterns,
  "<tt>ctyp</tt>" for types, "<tt>str_item</tt>" for structure items,
  and so on. Each node corresponds to a possible value of this
  type.</p>

<div id="tableofcontents">
  <ol>
    <li><a href="#a:Transitional-and-Strict-modes">Transitional and Strict modes</a></li>
    <li><a href="#a:Compatibility">Compatibility</a></li>
    <li><a href="#a:Two-quotations-expanders">Two quotations expanders</a></li>
    <li><a href="#a:Syntax-tree-and-Quotations-in-the-two-modes">Syntax tree and Quotations in the two modes</a></li>
  </ol>
</div>

<h2 id="a:Transitional-and-Strict-modes">Transitional and Strict modes</h2>

<p>Since version 5.00 of Camlp5, the definition of the syntax tree has
  been different according to the mode Camlp5 has been installed:</p>

<ul>
  <li>In <a href="ast_transi.html"><em>transitional</em></a> mode,
    this definition is the same than in the previous Camlp5
    versions.</li>
  <li>In <a href="ast_strict.html"><em>strict</em></a> mode, many
    constructor parameters have a type enclosed by the predefined type
    "<tt>Ploc.vala</tt>".</li>
</ul>

<p>The advantage of the transitional mode is that the abstract syntax
  tree is fully compatible with previous versions of Camlp5. Its
  drawback is that when using the <a href="q_ast.html">syntax tree
  quotations in user syntax</a>, it is not possible to use
  antiquotations, a significatant limitation.</p>

<p>In strict mode, the abstract syntax is not compatible with versions
  of Camlp5 previous to 5.00. Most of the parameters of the
  constructor are enclosed with the type "<tt>Ploc.vala</tt>" whose
  aim is to allow nodes to be either of the type argument, or an
  antiquotation. In this mode, the syntax tree quotations in user
  syntax can be used, with the same power of the previous syntax tree
  quotations provided by Camlp5.</p>

<h2 id="a:Compatibility">Compatibility</h2>

<p>As there is a problem of compatibility in strict mode, a good
  solution, for the programmer, is to always use syntax trees using
  quotations, which is backward compatible. See the chapter
  about <a href="ast_strict.html">syntax tree in strict mode</a>.</p>

<p>For example, if the program made a value of the syntax tree of the
  "let" statement, like this:</p>

<pre>
  ExLet loc rf pel e
</pre>

<p>In strict mode, to be equivalent, this expression should be
  rewritten like this:</p>

<pre>
  ExLet loc (Ploc.VaVal rf) (Ploc.VaVal pel) e
</pre>

<p>where "<tt>Ploc.VaVal</tt>" is a value of the type "<tt>vala</tt>"
  defined in the module <a href="library.html">Ploc</a> (see its
  section "pervasives").</p>

<p>This necessary conversion is a drawback if the programmer wants
  that his programs remain compilable with previous versions of
  Camlp5.</p>

<p>The recommended solution is to always write this code with
  quotations, namely, in this example, like this:</p>

<pre>
  <:expr< let $flag:rf$ $list:pel$ in $e$ >>
</pre>

<p>The quotation expanders ensure that, in strict mode, the variable
  "rf" is still of type "<tt>bool</tt>", and that the variable "pel"
  of type "<tt>list (patt * expr)</tt>", by enclosing them around
  "<tt>Ploc.VaVal</tt>".</p>

<p>In transitional mode, it is equivalent to the first form above.  In
  strict mode, it is equivalent to the second form. And the previous
  versions of Camlp5 also recognizes this form.</p>

<h2 id="a:Two-quotations-expanders">Two quotations expanders</h2>

<p>Camlp5 provides two quotations expanders of syntax trees:
  "<tt>q_MLast.cmo</tt>" and "<tt>q_ast.cmo</tt>".</p>

<p>Both allow writing syntax trees in concrete syntax as explained in
  the previous section.</p>

<p>The first one, "<tt>q_MLast.cmo</tt>" requires that the contents of
  the quotation be in <a href="revsynt.html">revised syntax</a>
  without any syntax extension (even the <a href="parsers.html">stream
  parsers</a>). It works in transitional and in strict modes.</p>

<p>The second one, "<tt>q_ast.cmo</tt>" requires that the contents of
  the quotation be in the current user syntax (normal, revised, lisp,
  scheme, or other) and can accept all the syntax extensions he added
  to compile his program. It fully works only in strict mode. In
  transitional mode, the antiquotations are not available.</p>

<h2 id="a:Syntax-tree-and-Quotations-in-the-two-modes">Syntax tree and Quotations in the two modes</h2>

<p>For the detail of the syntax tree and the quotations forms, see the
  chapters about the <a href="ast_transi.html">syntax tree in
  transitional mode</a> and the <a href="ast_strict.html">syntax tree
  in strict mode</a>.</p>

<a class="toplink" href="ml_ast.html"></a>
<div class="trailer">

  <hr style="margin:0" /><div style="font-size: 80%"><em>Copyright 2007-2017
      Daniel de Rauglaudre (INRIA)</em></div>

  <p class="bottom">
    <a href="http://validator.w3.org/check?uri=referer"><img
       alt="Valid XHTML 1.1" height="31" width="88" /></a>
  </p>

</div>

</div>

</body>
</html>