[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CENTAUR annotations
- Subject: Re: CENTAUR annotations
- From: bertot@paprika.inria.fr (Yves Bertot)
- Date: 29 Mar 93 08:03:46 GMT
- Keywords: pragmas, annotations, parsing comments unavailable.
Annotations are a powerful tool for tree manipulation inside Centaur, but their
relation to the parser is unclear and, in some sense, unreliable. Note that
the relation of annotations to TYPOL is also unclear and unreliable (annotations
are not transmitted to the logical engine either, and procedures like getannot
or sendannot are difficult to use).
Annotations are treated implicitly in the parser. In fact, only one kind of
annotation is treated: comments. The parser is equipped to receive comments, taken
as strings, and to attach these comments in the tree. No action is provided, and
thus you can't parse the comments. Moreover, you have no control on which tree
the comment will be attached to (The parser uses a notion of proximity which
is not always the most natural: if you have <c> ::= <a> <b>; and you want
to attach a comment to <c>, it may be attached to <a> instead).
My advice is that you avoid using annotations and you express explicitly the
possibility of having pragmas in you syntax. This can be done systematically
by replacing sets of rules of the form:
<a> ::= <b> <c>;
op(<b>,<c>)
by rules of the form
<a> ::= <b_with_pragma> <c_with_pragma>;
op(<b>,<c>)
<b_with_pragma> ::= <b>
<b>
<b_with_pragma> ::= <pragma> <b>;
annotated_b(<pragma>,<b>)
.
.
.
I understand this will inflate your description drastically, but this will be
more reliable and you will be more at ease to use semantic tools like TYPOL on
the trees you build.
Yves.