| ||
Advanced Issues: Using the Code Twice |
The module system in gbeta is basically the
same as in the Mjolner BETA System, i.e. it is based on the fragment language
and the notion of a fragment graph whose edges are specified using
properties at the top of source code files such as
Firstly, since the implementation of the fragment language builds on a search-and-replace semantics with added checks in the fragment graph for correct visibility decisions, the fragment system in gbeta allows all non-terminals in the grammar as slots. However, the parser does not allow slot applications in all positions of the syntax, and the error checking which should detect inconsistencies is incomplete. Hence, you can use a very large subset of the (ideal) fragment language, much more than supported by the Mjolner BETA System, but real separate compilation would require significant changes in the current implementation of gbeta, and there are some glitches. If things start behaving in strange ways, please go back and use the fragment language in more conventional ways..
One of the genuinely new properties of the gbeta fragment language is
that it is possible to have more than one This is the reason for the title of this section. It looks like this, e.g.:
"x" ends up in two
different contexts, and this means that two entirely separate sets of
information from static analysis ("semantic attributes") must be
maintained. The reason why this might be useful is that it makes it
possible to express and exploit the fact that two implementations of
something may be different when it comes to the type system, but still
so related at some (conceptual) level that the source code is
syntactically identical.
Example 10Here's a runnable example of that:
betaenv .
|