如何开始编写转码器?甚至可能吗? [英] How do I start writing a transpiler? Is it even possible?

查看:209
本文介绍了如何开始编写转码器?甚至可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于保密原因,我可能无法在定位点详细描述,但这里是场景。



有流媒体应用程序的各种设备具有不同的语言不同的apis,虽然他们完成同样的事情。所以,当你想为一个平台编写一个流应用程序时,你必须从头开始,同时为其他平台复制相同的应用程序,这是写冗余逻辑。我想设计一个转码器,它采用一种语言的代码,并为所有的母语生成代码,种类1到许多,但不知道如何开始,并在互联网上找不到足够的引用。是否可行呢?目标语言包括javascript和主要java的变体。

解决方案

你可能想看看(甚至加入)源编译器项目,如 Haxe
它已经可以从Haxe源代码编译为Java,JavaScript,C#,C ++,NekoVM,Flash和Python(实验性)。



更多信息: p>


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 references on the internet. Is it even feasible to do it? the target languages include variants of javascript and primarily java.

解决方案

You might want to look at (or even join) an open-source compiler project like Haxe. It already can compile from Haxe source code to Java, JavaScript, C#, C++, NekoVM, Flash and Python (experimental).

More info:

这篇关于如何开始编写转码器?甚至可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆