making of a language

Started by
1 comment, last by ToohrVyk 15 years, 5 months ago
I am currently making a language with xml but sometimes I wan't to make commands in other languages.Is there any way I could do this?If you know a web page I could visit then please link. Thank you
Advertisement
Why XML? It is terribly verbose for such a task.

If by "make commands in other languages" you mean use types or functions defined by other languages, then it is possible. How is pretty much up to you, after all you are writing the language.
You can do this pretty easily. For instance, I could do like XSLT does and use:
<xsl:value-of select="php:frobnicate(@content)"/>
This calls the "frobnicate" PHP function.

Of course, the hard part is getting your compiler or interpreter to actually handle this. For instance, when running XSLT from PHP, you can register PHP functions to be run from XSLT. In the general case, you can use any technique available to the interpreter (or compiler target) for calling external functions.

But there are so many possible interpreters or compiler targets that I'm not going to give you a complete list of how to do it, nor will you find a complete list online. However, if you told us your interpreter technology or compiler target technology, we would be able to help.

This topic is closed to new replies.

Advertisement