Ideas for a non-destructive Target System

Monkey Archive Forums/Monkey Discussion/Ideas for a non-destructive Target System

bruZard(Posted 2013) [#1]
At first: Excuse my bad english. I hope you can understand what i try to tell.

Monkey had a wide range of target languages: C++, C#, Java, ActionScript and JavaScript. If you would implement a new Target with these languages as target ... why you have to recompile Trans?

A solution is to define a new Target with an XML File:
<?xml version="1.0" encoding="utf-8" ?>
<target name="AmigaOS3">
	<language>cpp</language>
	<compiler_base>{SYSTEMDRIVE}/AmiDevCpp</compiler_base>
	<compiler_path>/usr/local/amiga/bin/</compiler_path>
	<option>
		<release>m68k-amigaos-g++ -noixemul -O6 -o {APPTITLE} main.cpp</release>
		<profile>m68k-amigaos-g++ -noixemul -O6 -o {APPTITLE} main.cpp -lwinmm</profile>
		<debug>m68k-amigaos-g++ -noixemul -g -O6 -o {APPTITLE} main.cpp</debug>
	</option>
	<modules>amiga</modules>
</target>

If you want to implement a new target language, you have to touch Trans. But the most new targets use the currently implemented target languages.
Modules should do the main work for the details of the new target functionality.


MikeHart(Posted 2013) [#2]
Like i said on the german forum, for a new target that doesn't need a new target language, you don't need ot alter Trans.

But if you need a different compiler your approach is reasonable. You don't need an XML file for it, but the idea is a good one.


bruZard(Posted 2013) [#3]
No, but if you need another Compiler, you have to touch Trans.


AdamRedwoods(Posted 2013) [#4]
yes, i've thought of something like this and created a prototype:
http://www.monkeycoder.co.nz/Community/posts.php?topic=4932

but the problem i ran into was that even if target CustomTarget ran an external trans_cc, the target maintainer would have to keep up with all the monkey changes (each time the main trans_cc changed). i suspect that many targets would fall out of date.

so my final thought was to create a "shared lib" target for the 3 trans_cc.exe. then create a target that uses the sharedlibs to define what to do.

AN XML file wouldn't work for me or some of the other targets, since I extend one of the CppTranslator classes to add in new functionality (wxMonkey).

I'm still investigating this solution path.


bruZard(Posted 2013) [#5]
I'am aware that not everyone can use my idea of a new target system ... but very close concepts can be realised with just a few files and without recompile trans. If you want to use another language (like BlitzMax or LUA or Python) you have to edit trans.


slenkar(Posted 2013) [#6]
how about embedding lua into trans , trans does the heavy stuff like translation