Native to Monkey easy ?

Monkey Archive Forums/Monkey Discussion/Native to Monkey easy ?

Paul - Taiphoz(Posted 2013) [#1]
Been thinking about target's recently and it dawned on me to ask if anyone had tried converting something native into monkey rather than the other way around.

Anyone tried it ? or thought about it ?

therevills(Posted 2013) [#2]
The issue with native to Monkey is that native can do everything for the target platform, yet Monkey has only a subset command base. So your native implementation would be limited to what Monkey can do...

Paul - Taiphoz(Posted 2013) [#3]
Yeah I knew a 1:1 converter wouldnt be possible, might be cool if it converts everything it can, and then just copies over the native code it cant with a comment above it to say "Hay this is native you need to monkey it up".

Skn3(Posted 2013) [#4]
Well I wrote some regular expressions and ran it through a batch reg ex app. Managed to do about 80% of the port of the csharp spine runtime with the expressions.

I had to do some manual bits like converting everything to arrays and compensate for lack of function pointers. It was fairly pain free.

Generally the best option is to look for JavaScript, flash or csharp versions of whatever you are trying to port as language wise they are close to monkey.

Paul - Taiphoz(Posted 2013) [#5]
Would pure java not easily port over ? as I look through my hardrive I think the only source I have for anything other than my own code is minecraft.

Skn3(Posted 2013) [#6]
Yeah pure java would probably be quite easy too. What kind of thing are you looking to port?

Paul - Taiphoz(Posted 2013) [#7]
I really don't have anything that I would like to port to monkey from a native language, nothing that springs to mind at least, I have a ton of Blitz and Max stuff I will be porting but their not targets.

This whole post was simply me having a thought and sharing it with the forum to see if anyone else had thought about it.

I guess in terms of practical uses' if you think about some one who has a project in one of the targets, but they cant code in the others, they could port back to monkey and then use monkey to export their project to the other targets.

Skn3(Posted 2013) [#8]
Yeah I reckon that would be amazing, it would really make the entry into the language very easy. I was tempted to write a more complete csharp translator but opted for a more sensible semi-automated approach.

Nobuyuki(Posted 2013) [#9]
Pure Java is portable in many cases (I ported monkey-timsort from pure java), but there are some things monkey doesn't support that you'll find in java, such as wildcards and generic interfaces. These may or may not be trivial to work around, depending on the complexity of the code.