[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compilation units



Dear Frederic,

> 1.
> I have a doubt about the simplest unit(s) we have to compile - and therefore
> the label(s) of the roots of the abstract syntax trees that we have to produce
> (or to read for the forthcoming tools). For instance if a file contains
> 
>     spec fv = sort my_sort end
> 
> What are we defining: a SPEC-DEFN or a LIB-ITEM
> What is the label of the root of its syntax tree ?
> 
> Is it a SPEC-DEFN or is it rather a LIB-ITEM vertex whose single child is the
> subtree labeled by SPEC_DEFN ?
> 
> Or, to word it in a different way, what are the productions for the axiom
> of concrete grammar. The question come from the fact that we have
> a set of rules (Section C.2.4)
> 
> LIB-ITEM ::= SPEC-DEFN | VIEW-DEFN | ...
> 
> 
> 2. Do we allow a file to contain more than one such unit (hence the
> output file will contain a sequence of independent such abstract trees)

Looking at the CASL summary, the answer is:
A file should contain a LIBRARY, and this should also be the label
of the abstract syntax tree.
(It makes no sense if a file contains just a SPEC-DEFN, since typically
a SPEC-DEFN will refer to other named SPECs, and they should
also occur in the file, or be imported using a "from ... get ...").

Currently, none of the parsers seems to obey this rule,
but I think we should modify the parsers according to this rule.

A possible relaxation would be to allow to omit the inital
"library ID", which means that you also can enter just a single SPEC,
or a list of LIB-ITEMs.
Still, one should produce a tree with label LIBRARY (with an
empty library name).
Though we have implemented this relaxation in our parser, I am
even not so sure about this. Perhaps it is better to force users
always to use the full CASL syntax.

Greetings,
Till