|
|
Grammar
'' and a syntax
extension file ``pa_extend.cmo
'' to program grammars. All
details on modules, types and functions are described
chapter 7.Grammar.create
''. It takes a lexer as parameter. A good
candidate it the function ``Plexer.make
'' but the user can
creates its own lexer, providing that it is of type
``Token.lexer
''.Grammar.Entry.create
''. The first parameter is the grammar,
the second one is a string used to name the entry in error messages
and in entries dump. Entries are created empty, i.e. raising
``Stream.Error
'' when called. An entry is composed of entry
precedence levels, the first one being the least precedent and the
last one the most.Grammar.Entry.parse
''. In case of syntax error, the
exception ``Stream.Error
'' is raised, encapsulated by
the exception ``Stdpp.Exc_located
'', giving the location
of the error.
|
Grammar.extend
''. But its interface being quite complicated
and, as it must be used with appropriate type constraints, the Camlp4
library provides a file, named ``pa_extend.cmo
'', compatible
with ``pa_o.cmo
'' and ``pa_r.cmo
'' which creates a new
instruction doing this work.EXTEND
'' which has the following
format:EXTEND |
{ GLOBAL : global-list ; } |
entry : { position } extension ; |
... |
entry : { position } extension ; |
END |
EXTEND
, GLOBAL
and END
are keywords.
There are some other keywords in this instruction, all in uppercase.