I am developing a translator that converts JavaScript source into a target language. I am trying to implement JavaScript's Math object in the target language.
If there is a JavaScript implementation of the "Math" object, I can use the translator to obtain the equivalent code in the target language.
I am looking for something like this:
var Math = {
pow: function(...) {...}
exp: function(...) {...}
/* other methods of Math */
}
Is there such an implementation that is available ? This would help me avoid manually writing the Math object's code in the target language.
The V8 implementation of math.js might provide you with some guidance, but of course it's riddled with placeholders for native function calls. You would have to be able to replace things like %Math_floor(x)
with the appropriate standard library based function call in the target language.
http://code.google.com/p/v8/source/browse/branches/bleeding_edge/src/math.js?spec=svn10758&r=10758
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With