[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: Re: Parameterized patterns
On trex-list, James Clark wrote: > Should patterns be able to take parameters? This would be a very useful feature. One use immediately comes to mind: a grammar for the OASIS table model could be parameterized on the allowable contents of a cell. > The main disadvantage is that this adds significant complexity. > > I also haven't yet thought through the implications of this for the > restrictions on recursion. I did something similar to this to implement macros in a DTD for mathematics. To avoid infinite recursion, it sufficed to add a restriction that macros had to be defined before they were referenced (I don't know how well this restriction would fit in with TREX though). The only other tricky issue was name capture: you have to be careful with things like: <pattern name="foo"> <param name="x"/> ... </pattern> <pattern name="bar"> <param name="x"/> ... </pattern> <pattern name="baz"> <param name="x"/> <ref name="bar"> <param name="x"> <ref name="foo"> <param name="x"><ref name="x"/></param> </ref> </param> </ref> </pattern> (Or without all the punctuation: "baz(x) = bar(x => foo(x => x))"). --Joe English jenglish@flightlab.com
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC