Hi Orton,

thanks for your explanation on CFG. I already feared that my knowledge
about parsers are not deep enough to understand the real underlying
problem why Damian didn't already spent us this feature.

As I stated already in my first mail:

> ........... Don't know how difficult it would be for Damian to 
> have an additional layer of state to handle inside the parser or wether
> this is by principle not possible, but if it is possible it would
> help for clarity, because the grammar stay's in the grammar part and
> not in the action part.

....

> > > >   exor : Mr ^ Mrs ^ hybrid
> 
> Hmm, again (afaict) as presented this is a non-context-free constraint.
> 
> But with a bit of gymnastics you can do this with P:RD using regexes:
> 
> salutation : /Mrs?/ first_name last_name
> first_name : /(?!Mrs?)\S+/
> last_name  : /\S+/
> 
> Or using lookahead matches
> 
> salutation : 'Mr' ...!'Mrs'
>            | 'Mrs' ...!'Mr'

but this works only for terminals and this is again not what
I need. I've choosen Mr and Mrs as subrule names just for an easy
demonstration what is needed, but in general this is necessary
for subrules:

exor    : subrule-1 ^ subrule-2 ^ subrule-3
subrule-1: subrule-11 ^ subrule-12 ....
......

but I guess this is again not possible with CFG parsers.

Anyway, the generated parser code is pure perl and we can solve
any of these problems with perl code in actions, why shall this
not be possible for P::RD direct?

You see, I've no guess how complicated it will be but perhaps it's
a greenly thought from me:

"Anyone who is able to create such a beast like Parse::RecDescent
is able to do anything!"

regards
        Charly

-- 
Karl Gaissmaier          Computing Center,University of Ulm,Germany
Email:[EMAIL PROTECTED]          Network Administration
Tel.: ++49 731 50-22499

Reply via email to