Post
by SirNukes » Sat, 2. Dec 17, 02:55
Conservatively compiled MD code wouldn't lose anything, unless the compiler were half baked. In general, a compiler is just a translator from some format to another format, the latter generally being closer to execution ready. If you take the trivial case of the input and output formats being matched (eg. the compiler takes MD xml code as input, and spits it back out), every MD capability would be preserved.
Xml has a lot of excess cruft that could be trimmed off, so a rudimentary compiler input format might just be a 1:1 mapping of MD nodes with an alternate syntax. Eg. a python-like syntax for block indentation would allow removal of the block closing tags like </do_all>, most of the node start/end tags ('<', '/>') could be trimmed (when not multi-lined), and most of the quotation marks could be omitted (when a space isn't present in the string).
Once the syntax is cleaned up a bit, the compiler could be expanded with extra coder convenience features, eg. function calls to be inlined at compile time, support for splitting code across multiple source files, etc. It could even have an editor built for it, similar to Exscriptor for X3, though it might be better to try to integrate into an existing developed editor, eg. setting up a custom language format for Notepad++.
On the other end of the spectrum would be a compiler that could take generic C++/Python/etc. code and process its AST into MD nodes. That would be an effort to get functional, and hard to make efficient, so it is probably too much effort for anyone to put into modding a niche spaceships game for no pay.