I'm contemplating the idea of implementing a XML translator using a compiler generator, based on the W3C's XML 1.1 spec, which includes a complete EBNF grammar.
More precisely, I plan to use Qi-YACC because I want to learn this tool. It will be my first foray into using any compiler-compiler.
The first kind of translation I'm planning to implement is very straightforward: XML to S-EXPRs. Afterwards, I plan to generalize my translator, but this is not the point of my question.
Do you anticipate any major pitfall for this kind of project? I've read that translating XML using its EBNF is a bad idea. I wonder why. And it's not like the Qi language already had a XML parser, so I'm definitely not looking to reinvent the wheel here.
I do not now the reason why context is needed to parse XML.
But QiYacc can make use of context using global variables. It would be cleaner if you could pass a state, S, in the parser e.g. or something like that. This is not in Qi but I plan to implement such a feature for Shen.
So it could be done.
/Stefan