[bitc-dev] thoughts on mixfix

Geoffrey Irving irving at naml.us
Wed Mar 11 12:36:07 EDT 2009


On Wed, Mar 11, 2009 at 12:02 PM, Jonathan S. Shapiro <shap at eros-os.com> wrote:
> <snip>
>
> First, we introduce a construct for describing *named* sub-grammars.
> These are constructed in the usual way that we are all familiar with.
> A sub-grammar introduced in this way may involve multiple productions,
> the first of which is the "start" production w.r.t. that sub-grammar.
> Defining a sub-grammar does not implicitly cause that grammar to
> become active for parsing purposes.
>
> <snip>
>
> Each sub-grammar is viewed as defining a *partial* order on operators,
> and the test for "merging" two grammars is to see if the combined set
> of inequalities from the respective top-level productions fails in
> some way.

It seems like combining two independent grammars would almost always
introduce ambiguities, since there would be no partial order
information between the two grammars.  Making this practical might
require a method for declarating partial order relations across
sub-grammars, which re-introduces some of the scoping issues.

For example, if I add a new syntax declaring a new binary operator,
how would I specify its precedence relative to +?

Also, agda defines precedence via a directed acyclic graph, not a
partial order, so that any precedence transitivity has to be manually
declared.  I'm not sure whether I'd prefer this or not due to the
quadratic blowup, but figured I'd mention it.

Geoffrey


More information about the bitc-dev mailing list