Next: Syntax
Up: Camlp4 manual
Previous: User syntax modifications
This chapter presents the Camlp4 quotation system. A quotation is a
part of a program enclosed by special parentheses in position of
expression or pattern, and whose treatment is done by an user
function, called a ``quotation expander''. Several quotations
expanders are usable in the same source code.
When Camlp4 encounters such a construction, the appropriate quotation
expander is called with the string contents of the quotation.
There are two kinds of quotation expanders:
- Those returning strings. The returned string is parsed by
Camlp4 afterwards. They are easy to use, but they depend on the
language syntax: the returned string must be of Ocaml syntax if the
language syntax used is Ocaml's, in Righteous syntax if the language
syntax is the Righteous one, etc.
- Those returning syntax trees. They are independant from
the language syntax used, but to use them, one muse know how to create
syntax tree nodes. See appendix A.
Daniel de Rauglaudre
9/1/1998