wrote:
> I'm wondering wondering what it would take to implement a compiler for
> a given language in XML/XSL.
Remember, XSL is a pure functional langauge. That may make some of the
manipulations a serious compiler would want to perform difficult.
But, yes, a basic old-fashioned just-replace-with-equivalent-code
transformation ought to be possible. This is not the set of tools I
would choose to do it in -- custom data structures are likely to be much
more efficient than trying to model everything in XML -- but if you're
looking for a pedagogical exercise, it could be a fun thing to try.
Were I you, I'd start with a language that has simpler syntax and
semantics than Java or C++, and use that to establish your framework and
understand the issues (including performance and memory space). Then, if
you're still feeling ambitious, go for it.
(Personally, I've stopped writing compilers for the sake of writing
compilers. I'd rather wait until I'm reasonably sure there's something
mine will do better than any existing alternative.)
More specifically, are there any XSL or
> XML based systems that assist in scanning pure source into XML so that
> the transformations can begin? Grammar could be provided in marked-up
> EBNF. This is probably over-optimistic could the process would need
> knowledge of LL/LALR etc.
>
> The alternative approach is to use your standard scanner/parser
> generator with it's own (non-interchangable) EBNF and have the action
> code generate tagged tokens, giving you an AST in XML.
>
> My questions:
> 1. Are there any decent XML shema's for EBNF?
> 2. Are there any tools / XSL extensions to do the above?
> 3. What are your thoughts on the whole idea?
>
> Best regards,
> Richard Brady
>