code-translation

translate one language to another?

元气小坏坏 提交于 2019-11-30 03:56:58
问题 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 so. could you translate php to other languages, like python or ruby? c++ to java and so on? 回答1: Translating one language to another is just a special case for the class of programs called compilers, interpreters and translators. This class of program

Java code transform at compile time

穿精又带淫゛_ 提交于 2019-11-30 01:37:38
I would like to transform java source code at compile time just before passing the source code to the compiler. In other word I would like to create a preprocessor able to transform "bla bla bla" into any other code such as: new MyClass("bla", 3) My actual motivation is to do string encryption, as explained here Some people suggest writing custom annotation processors but as far as I understand annotations: they can be used to generate new class file, but not to transform existing code before being passed to compiler they seem to work at package, class or method level, but not method body

Conversion from JavaScript to Python code? [closed]

一个人想着一个人 提交于 2019-11-29 22:53:36
Is there a relatively quick program out there to accomplish at least the basics of this? Just a few regexes? I'm willing to do some manual conversion, but this is a pretty big set of scripts. Lyndon White Updated Now several (4) years later this (almost certainly) can be done; though certainly not with RegEx. I suggest future readers look to @Piotr Dabkowski's answer. . Or some of the other answers. (I don't know having not tried them) Original Answer Hm this is a hard one. The definition of a compiler is translates from a higher level language to a lower level language. eg python to machine

How can I easily convert FORTRAN code to Python code (real code, not wrappers)

那年仲夏 提交于 2019-11-29 17:19:10
问题 I have a numerical library in FORTRAN (I believe FORTRAN IV) and I want to convert it to Python code. I want real source code that I can import on any Python virtual machine --- Windows, MacOS-X, Linux, Android. I started to do this by hand, but there are about 1,000 routines in the library, so that's not a reasonable solution. 回答1: edit : added information on numpy Such a tool exists for Fortran to Lisp, or Fortran to C, or even Fortran to Java. But you will never have a Fortran to Python

How to add an event handler in VB.NET? [closed]

陌路散爱 提交于 2019-11-29 15:14:31
This code is part of AjaxControlToolkitSampleSite . To be exact, it is in the AsyncFileUpload control: AsyncFileUpload1.UploadedComplete += new EventHandler<AsyncFileUploadEventArgs>(AsyncFileUpload1_UploadedComplete); How can I translate this to VB.NET? Here you go: AddHandler AsyncFileUpload1.UploadedComplete, AddressOf AsyncFileUpload1_UploadedComplete Alternatively, within your code, you can select the AsyncFileUpload1 control from the left-hand dropdown list (just above the code) and then select the UploadComplete event from the right-hand dropdown list. This will automatically create an

Automatically convert Scala code to Java code [closed]

我与影子孤独终老i 提交于 2019-11-29 11:21:42
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I have an app written in Scala and some of my team members want a Java version of it. It is a demo app to use another API written in Scala, and they want a Java version of the app to be able to use the API from Java. However, the app is somewhat large and I don't want to manually rewerite in Java (and they don't

Source-to-source compilation with LLVM [closed]

这一生的挚爱 提交于 2019-11-29 09:30:02
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I need to convert x86 assembly source code to LLVM human-readable .ll file (aka LLVM assembly language). How can I do this? If there is no direct solution would it be possible to implement one within the LLVM infrastructure with as less efforts as possible? I guess, the solution I'm looking for should be some

How to Cross-Compile Java Source Code to JavaScript?

两盒软妹~` 提交于 2019-11-28 16:19:36
Given a set of Java source code files, how can I compile them into one or more JavaScript files that can be used with hand-crafted JavaScript? GWT is one option, but every example I've seen so far is aimed at building fancy websites. The simple use case of just converting Java source to Javascript that can be used together with handcrafted JavaScript hasn't been well-documented . I started a thread on the GWT mailing list on this subject, but opinions seem to be mixed on whether this is even feasible. One person gave a very useful tip, which was to check out GWT-Exporter . The problem is that

Writing code translator from Python to C? [closed]

雨燕双飞 提交于 2019-11-28 08:36:43
I was asked to write a code translator that would take a Python program and produce a C program. Do you have any ideas how could I approach this problem or is it even possible? Shedskin: http://code.google.com/p/shedskin/ Boost Python: http://www.boost.org/doc/libs/1_42_0/libs/python/doc/index.html PyCXX: http://cxx.sourceforge.net/ Cython: http://www.cython.org/ from http://wiki.python.org/moin/compile%20Python%20to%20C , there's a list of related projects. Pyrex: http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/ psyco: http://psyco.sourceforge.net/ RPython: http://code.google.com/p

Android equivalent of NSUserDefaults in iOS

南笙酒味 提交于 2019-11-28 04:26:41
I'd like to save some simple data. On the iPhone, I can do it with NSUserDefaults in Objective-C. What is the similar command here in Android? I'm just saving a few variables, to be reused as long as the application is installed. I don't want to use a complicated database just to do that. christian Muller This is the most simple solution I've found: //--Init int myvar = 12; //--SAVE Data SharedPreferences preferences = context.getSharedPreferences("MyPreferences", Context.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); editor.putInt("var1", myvar); editor.commit(); //-