Implementing an XML Translator Using XML EBNF

I am considering introducing an XML translator using a compiler generator based on the W3C XML 1.1 specification , which includes a full EBNF grammar.

More precisely, I plan to use Qi-YACC because I want to learn this tool. This will be my first foray into using any compiler-compiler.

The first type of translation that I plan to implement is very simple: XML - S-EXPRs . Subsequently, I plan to generalize my translator, but this is not a question of my question.

Do you expect any serious errors for such a project? I read that translating XML using its EBNF is a bad idea . I wonder why. And it doesn't look like the Qi language already had an XML parser, so I'm definitely not going to reinvent the wheel here.

+3
source share
2 answers

Now I am not the reason why the context is needed for XML parsing.

But QiYacc can use context using global variables. It would be cleaner if you can pass the state, S, in the parser, for example. or something like that. This is not in Qi, but I plan to implement such a function for Shen.

.

/Stefan

+3

QiYACC, EBNF XML (RD) . , , . , , .

- ++, XML . , Code Project. .

. EBNF, EBNF .

+1

Source: https://habr.com/ru/post/1716938/


All Articles