Questions tagged [code-translation]

For questions regarding the translation of code from one programming language to another. NOTE that asking to have your code translated is not suitable for Stack Overflow.

Translating code from one programming language to another can be as tricky as translating between natural languages. This is due to the fact that languages implement different sets of features and are often designed with very different goals. What comes as a built-in function in one language may have to be developed from scratch (or at least require a library) to achieve the same functionality in another.

An appropriately formed question might be "How do I translate this statement", or "What are the differences between these two statements in different languages". It is not appropriate to ask for your code to be translated.

388 questions
8
votes
3 answers

Source-to-source compiler framework wanted

I used to use OpenC++ (http://opencxx.sourceforge.net/opencxx/html/overview.html) to perform code generation like: Source: class MyKeyword A { public: void myMethod(inarg double x, inarg const std::vector& y, outarg double&…
8
votes
3 answers

How can I convert Ruby to Lua?

Is there any way to automatically convert Ruby code to Lua? My question is: What kinds of tools exist for this purpose? What are their limitations? One primary goal of this is to be able to bypass the Ruby interpreter when I execute the…
nickb
  • 9,140
  • 11
  • 39
  • 48
8
votes
2 answers

Modern Ada to C/C++ translator

Is there any source-to-source converter (translator) from Ada (95, 2005) to C? How full they are (can they convert every feature of Ada into gnu c99 + pthreads + POSIX)? Is it possible to use such ada-to-c translator in critical applications? PS:…
osgx
  • 90,338
  • 53
  • 357
  • 513
7
votes
2 answers

Assembly Converting MOV / MOVZX and MOVSX to C code (no inline asm)

For the asm emulator i'm trying to write to convert ASM code to equivalent working code just working.. best code would be the one that can either be done in one line or two-three the most, don't care about speed. From my understanding. MOVZX would…
SSpoke
  • 5,656
  • 10
  • 72
  • 124
7
votes
2 answers

C++ to F# smooth translation

Hey folks, I have the following piece of code from C++. for (int i=0; i < nObstacles; i++) { int x,y; bool bAlreadyExists; do { x = rand() % nGridWidth; y = rand() % nGridHeight; } while…
user627943
  • 125
  • 4
7
votes
1 answer

Replicating seed setting from Stata

I'm trying to replicate in R a bit of code someone else wrote in Stata, and have hit a wall trying to predict the behavior of their p-RNG. Their code has this snippet: set seed 123456 Unfortunately, it's a bit nebulous exactly the algorithm used by…
MichaelChirico
  • 33,841
  • 14
  • 113
  • 198
7
votes
3 answers

Is there any free Python to C translator?

Is there any free Python to C translator? for example capable to translate such lib as lib for Fast content-aware image resizing (which already depends on some C libs) to C files?
Rella
  • 65,003
  • 109
  • 363
  • 636
7
votes
1 answer

Haskell equivalent of this Python code

I'm learning Haskell after Python, and I thought that making a function that finds all the items in a sequence that aren't in another (where both sequences have elements that can be compared) would be an interesting exercise. I wrote some code for…
rlms
  • 10,650
  • 8
  • 44
  • 61
7
votes
4 answers

translate one language to another?

is it possible to translate one language to another with an interpreter? heard that quercus could translate php to java? at first, i thought it was a cheap lousy solution which could give code errors, but it seems that it´s fully possible to do…
ajsie
  • 77,632
  • 106
  • 276
  • 381
7
votes
2 answers

Is there any tool to translate Lisp code into Python?

Because I want to use Lisp's syntax and Python's libraries. Maybe some tools like Parenscript but generates Python code instead of Javascript.
SaltyEgg
  • 1,498
  • 1
  • 15
  • 26
7
votes
10 answers

Why convert code in one language to another?

I have heard of some compilers that convert code in one high level language to another e.g Shedskin that converts python code to optimized C++. I was wondering why would one ever try to do that. Why not directly write in the desired language…
sud03r
  • 19,109
  • 16
  • 77
  • 96
6
votes
1 answer

Assembly How to convert REP STOS to C code

I been debugging REP STOS DWORD PTR ES:[EDI] for a while now From my conclusion it always uses ECX as counter. EAX as the value that will be copied over EDI and then appended ECX times so after putting in the pointed dump of EDI it seems to…
SSpoke
  • 5,656
  • 10
  • 72
  • 124
6
votes
2 answers

What is the pure JavaScript equivalent of jQuery's .parents() method?

Apologies for this kind of question, but I can't find an answer on You Might Not Need jQuery or anywhere else online and I'd really like to know: What is the pure JavaScript equivalent of jQuery's .parents() method? For example, it would be great to…
user5508297
  • 805
  • 2
  • 9
  • 24
6
votes
3 answers

Translating Stata to R: collapse

Just came across a .do file that I need to translate into R because I don't have a Stata license; my Stata is rusty, so can someone confirm that the code is doing what I think it is? For reproducibility, I'm going to translate it into a data set I…
MichaelChirico
  • 33,841
  • 14
  • 113
  • 198
6
votes
1 answer

TypeScript Compile Error Cannot invoke an expression whose type lacks a call signature

error message after transpiling code below: [tsc] > C:/Workarea/MyFirstAngular/src/enum/msg.ts(35,33): error TS2349: Cannot invoke an expression whose type lacks a call signature. Failed to compile TypeScript: Error: tsc command has exited with…
Synoon
  • 2,297
  • 4
  • 22
  • 37
1 2
3
25 26