4.2 Extending the language
The language predefined syntaxes, ``pa_o.cmo
'' and
``pa_r.cmo
'' use the Camlp4 grammar system: so they are
extensible.
The module ``Pcaml
'' holds grammars and entries variables used
by the langage predefined syntaxes files. Syntax extensions can be
done by extensions of the appropriate entries.
In some entries, ``pa_o.cmo
'' and ``pa_r.cmo
'' define
labels allowing to locate some levels and to add new rules relative to
these levels. The entries and their labels are:
-
``
Pcaml.expr
'', for expressions, with the labels:
-
``
let
'' corresponding to the level of the instruction
``let
...in
''.
- ``
||
'', ``&&
'', ``<
'',
``+
'', ``*
'', ``**
'' corresponding to the so named
operator.
- ``
apply
'' corresponding to the curryfied application.
- ``
simple
'' corresponding to simple expressions.
- ``
Pcaml.patt
'', for patterns, with the
label ``simple
'' corresponding to simple patterns.
- ``
Pcaml.ctyp
'', for types, with the
label ``simple
'' corresponding to simple types.
- ``
Pcaml.sig_item
'' and ``Pcaml.str_item
'', for
signature and structure items,
with only one level labelled ``top
''.
- ``
Pcaml.module_type
'' and
``Pcaml.module_expr
'', for module types and expressions.
- Some other labels exist but are not documented.