On Sun, 2007-07-29 at 07:42 +1000, skaller wrote:
> You can now write:
> 
> syntax dssl {
>       private fred := ...
> 

BTW: there's one problem with this. At present every anonymous
nonterminal, such as in

        x := a (b c)* d;

is unique. However this can generate a lot of duplicate rules.
I just deleted

        sopt_equal := =; =># "()";
        sopt_equal := epsilon =># "()";

and replaced 'sopt_equal' by 

        = ?

in 8 places, in the hope it makes the grammar more readable
to end users. However they're not equivalent: this now generates
8 extra nonterminals with 16 rules. 

It should be possible to detect shared cases of

        nt *
        nt +
        symbol ?

by simply comparing their names. More generally, we have

        (x y) *

and we have to make

        tmp :=  x y;

and that too should be shared: the user actions for combinators
are always the same.

So .. the PROBLEM is that the sharing detection must be done
when the rules are parsed, because that's when they're expanded
into a more primitive form -- but this is impossible in the
presence of private nonterminals, because we can't tell if
a nonterminal is private until the whole dssl is processed.

We'd have to resort to sharing within a dssl only.
Of course it CAN be done at the point of opening a dssl,
with a full analysis of all the dssl's being opened .. ;(


-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to