Is there any way to have a context dependent rule?
A B
Where B depends on the "value" of A.
e.g.,
A = [abc]
B = [efg]
A B{A=a}
The idea is that the rule B only matches if the rule A matched an a.
Probably a much better way to implement it, just trying to demonstrate a possible solution. For simple context dependent grammars, this should work well. I imagine one could do it by grossly complicating the grammar which I want to avoid... it can be done programmatically but I'd rather do it in the grammar if possible, and if not, extend pegged to do it if it is not too difficult.
Is there any way to have a context dependent rule?
A B
Where B depends on the "value" of A.
e.g.,
A = [abc] B = [efg]
A B{A=a}
The idea is that the rule B only matches if the rule A matched an
a
.Probably a much better way to implement it, just trying to demonstrate a possible solution. For simple context dependent grammars, this should work well. I imagine one could do it by grossly complicating the grammar which I want to avoid... it can be done programmatically but I'd rather do it in the grammar if possible, and if not, extend pegged to do it if it is not too difficult.