Re: A Proposal for an ixml Preprocessor

The rule is that nothing gets renamed by the processor in the importing 
grammar. This is so that authors get error messages in the terms of what 
they have written.


It is assumed that the libraries are already tested and correct; all 
renaming occurs within the libraries, and is not visible to the importing 
grammar's author. In principle, the author knows and sees nothing of the 
renaming, and the resulting serialisation remains exactly the same, the 
renaming is not visible. Renaming is only done to remove name clashes, but 
the semantics remain exactly the same.


It's not clear to me if your question relates to two libraries, or a 
library and the invoking grammar. If you are importing z from A, then you 
are better off not creating a rule called z in your own grammar, but if you 
need to have it called z on serialisation then there are already mechanisms 
for that:


--B.ixml--
+use zz from A.ixml .
a : z, b , zz>z .
b : "B" .
z : "BA" .


or


--B.ixml--
+use z from A.ixml .
a : zz, b , z .
b : "B" .
zz>z : "BA" .


Groetjes,


Steven

On Tuesday 12 November 2024 09:56:51 (+01:00), Nico Verwer (Rakensi) wrote:


On 11-11-2024 14:25, Steven Pemberton wrote:

Enclosed is a document proposing a preprocessor that allows the 
construction of an ixml grammar from several 'library' grammars without 
having name clashes, and without changing the semantics of ixml.


This looks like it could be very useful.
As far as I understand this now, there is no way that a grammar A importing 
a grammar B could specify how a conflicting rule is renamed?
To illustrate what I mean, suppose that both grammars A and B have a rule 
for z:

--A.ixml--
x : y , z.
y : "Y" .
z : "AZ" .
-----

--B.ixml--
+use zz>z from A.ixml .
a : z, b , zz .
b : "B" .
z : "BA" .
-----

I am not sure if I have the renaming right, or if it should be the other 
way around.
Here, the B grammar knows that zz is the z from A, and can use both A's z 
and its own.


Best regards,
Nico

Received on Tuesday, 12 November 2024 12:04:43 UTC