code-translation

Python on Rails?

≡放荡痞女 提交于 2019-12-02 20:36:51
Would it be possible to translate the Ruby on Rails code base to Python? I think many people like Python more than Ruby, but find Ruby on Rails features better (as a whole) than the ones in Python web frameworks. So that, would it be possible? Or does Ruby on Rails utilize language-specific features that would be difficult to translate to Python? This is a great blog post . Rails developers chose a framework, and coding in Ruby is the afterthought. Python developers chose the language for the language, not the framework. On the other hand, that made a lot lower bar to entry for frameworks.

How do I start writing a transpiler? Is it even possible?

安稳与你 提交于 2019-12-02 18:16:37
Due to confidentiality reasons, I might not be able to describe in pin point details but here is the scenario. Various devices that have streaming apps have different languages with different apis, though they accomplish the same thing. So, when you want to write a streaming app for one platform, you have to start from scratch while copying the same app for other platform, which is writing redundant logic. I want to design a transpiler, that takes code in one language, and produces code for all the native languages, kind of 1 to many, but am not sure how to start, and cannot find enough

How to handle Translation in twig file using variables?

荒凉一梦 提交于 2019-12-02 17:53:43
I have a twig file and a yml in which i define the variables for translation, For ex. : YML File - variable.for.translation: Disponible, para tí Content of Twig File - <h2>"Hola, Follow {{ variableName }} en Twitter</h2> I wanted to make a variable for Hola, Follow {{ variableName }} en Twitter in translation file (i.e my yml file). Currently i am doing it like this : In YML - follow.us.twitter: Hola, Follow follow.us.twitter1: en Twitter In Twig - <h2>{{ "follow.us.twitter"|trans([], "workend") }} {{ variableName }} {{ "follow.us.twitter1"|trans([], "workend") }}</h2> Its working fine, but

Programming languages that compile into C/C++ source? [closed]

Deadly 提交于 2019-12-02 14:27:01
I'm using CoffeeScript to make JavaScript development easier. It's a language with clean syntax that compiles into JavaScript. So, what are the established programming languages that compile into C/C++ source code, to simplify syntax and/or enhance functionality? M.Stoffregen The language Haxe can output to C++, C#, Java, JavaScript, Python(experimental), PHP, Flash and NekoVM. Vala and Genie are languages that use the GObject type system and compile to C code. I've never used them but they look interesting. GObject is the type system used by GTK but I believe it's separable from GTK. GHC (the

Is there a converter of Javascript to Dart?

送分小仙女□ 提交于 2019-12-01 13:58:37
问题 Is there an automatic converter of javascript code to Dart? Or is it too soon? 回答1: There's a recent tool called JSParser and does all its magic using Dart itself, that is the parser is written in Dart. On a related noted there is Frog (and it comes with the standard SDK) which converts Dart to Javascript, it's also written in Dart making it a good showcase for the language. 回答2: Probably too soon. I believe Dart came out earlier this week. As some of the others have mentioned, there might

Translating C to JavaScript [closed]

对着背影说爱祢 提交于 2019-11-30 13:41:33
问题 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've got a bunch of math/dsp algorithms in C. Single functions, one function per file, no fancy linking or includes or preprocessor directives, only c99 and standard library calls (mainly memset and memmoves to handle array copying etc). Translating them is not a big problem, but it takes time. I was wondering

Converting Python Code to PHP

£可爱£侵袭症+ 提交于 2019-11-30 12:35:11
Is there a software converter out there that can automatically convert this python code to PHP? #!/usr/bin/python import math def calcNumEntropyBits(s): if len(s) <= 0: return 0.0 symCount = {} for c in s: if c not in symCount: symCount[c] = 1 else: symCount[c] += 1 entropy = 0.0 for c,n in symCount.iteritems(): prob = n / float(len(s)) entropy += prob * (math.log(prob)/math.log(2)) if entropy >= 0.0: return 0.0 else: return -(entropy*len(s)) def testEntropy(s): print "Bits of entropy in '%s' is %.2f" % (s, calcNumEntropyBits(s)) testEntropy('hello world') testEntropy('bubba dubba')

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

家住魔仙堡 提交于 2019-11-30 11:51:14
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. 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 tool, for a simple reason: unlike Fortran, Lisp or C, Python does not have GOTO [1]. And there are many

C99 printf formatters vs C++11 user-defined-literals

走远了吗. 提交于 2019-11-30 08:05:16
This code: #define __STDC_FORMAT_MACROS #include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h> int main(int argc,char **argv) { uint64_t val=1234567890; printf("%"PRId64"\n",val); exit(0); } Works for C99 , C++03 , C++11 according to GCC 4.5 , but fails on C++11 according to GCC 4.7.1 . Adding a space before PRId64 lets GCC 4.7.1 compile it. Which one is correct? gcc 4.7.1 is correct. According to the standard, c++11 2.2 Phases of translation [lex.phases] 1 - The precedence among the syntax rules of translation is specified by the following phases. [...] 3. The source

Source-to-source compilation with LLVM [closed]

坚强是说给别人听的谎言 提交于 2019-11-30 05:33:31
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 kind of llc 's counterpart that converts .s file back to .ll representation. bsa2000 Just for those who are still seeking for more information on this topic, I want to share the information about one ongoing project ( http://dslab.epfl.ch/proj/s2e ) that I've found on the web. The project