Kripa Sundar wrote:
[...]
> Since regexps have backtracking built in, won't it be easy to
> test each rule as a string, instead of handling the LHS and
> RHS separately? The m{}x regexp at the bottom of the
> following code seems to capture your definition of CH-1,
> although I may be mistaken.
Yep, pretty much, I must have had a block last night. Additionally, I
was very fixed on the idea of rolling all of that myself instead of
working with strings like one ought to in Perl.
[snip code broken by my newsreader's indentation]
That code looks okay. There remains one issue I'm not quite sure about
myself:
(same conventions for the token names and types as in the original post)
uAvBw -> uxvxw, where the x's may be different x's.
This is intuitively context-sensitive (but not quite complying to the
spec of uAv -> uxv). In the sense of all terminals on the left side
being preserved. But handling that is hard, IMO anyway.
How would you handle such a beast for any number of
terminal-nonterminal-terminal-... combinations?
Thanks a lot,
Steffen