Juan R. schrieb: > > Given two languages L1 = (G1,T1), L2 = (G2, T2 ) where G1, G2 are > > grammars and T1, T2 transformers that transform source written in L1 or > > L2 into some base language > > L0 = (G0, Id ). Can G1 and G2 be combined to create a new grammar G3 > > s.t. the transformers T1 and T2 can be used also to transform L3 = (G3 > > = G1(x)G2, T3 = T1(+)T2) ? In the general case G3 will be ambigous and > > the answer is NO. > > You mean direct compositionality. Is there any formal proof that you > cannot find a (G2' , T2') unambiguously generating (G2, T2) and > combining with L1 or this is always possible?
You mean a universal language adapter? I guess this is always possible using alpha conversion but I don't believe this leads to theoretical or practical interesting solutions but is just a limit concept. > This would not work for language enhancements but for composition of > completely independent languages. The practical problem with composing enhancements is that any two extensions L1, L2 share a lot of rules and rely on their structure. What if they don't just extend their host language L0 conservatively but also redefine rules of L0? This is not just a theoretical problem but it happens quite naturally if you want to adapt an extension developed for Python 2.4 for working with Python 2.5. Here Python 2.5 is considered as just another particular extension. Obviously Py3K will become an interesting testcase for all kinds of syntactical and semantical transformations. -- http://mail.python.org/mailman/listinfo/python-list