Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 11 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
这可能不是您想要的,但您可以让 OCaml 编译器将其运行时代码转储为 C:
您得到的基本上是字节码的静态转储。结果将类似于:
您可以使用以下命令编译它。
有关详细信息,请参阅 OCaml 手册。
This probably isn't what you want, but you can get the OCaml compiler to dump its runtime code in C:
What you get is basically a static dump of the bytecode. The result will look something like:
You can compile it with
For more information, see the OCaml manual.
有一个用于 C 源代码编译器的 OCaml 字节码可执行文件:
https://github.com/ocaml-bytes/ocamlcc
因此,首先将代码编译为字节码可执行文件然后使用
奥卡姆勒克。
There is an OCaml bytecode executable file to C source code compiler:
https://github.com/ocaml-bytes/ocamlcc
So, first compile your code to a bytecode executable then use
ocamlcc.
OCamlJS 项目将是一个很好的起点。它将 OCaml 编译为 JavaScript;应该可以修改它以将 OCaml 编译为 ActionScript。编译为 C 可能会需要更多工作 - 没有任何类型的垃圾收集 - 但并非不可能,特别是如果 Adobe Alchemy 提供 API 来满足其中一些需求的话。
The OCamlJS project would be a good starting point. It compiles OCaml to JavaScript; it should be possible to modify it to compile OCaml to ActionScript. Compiling to C would probably be more work - no garbage collection of any kind - but not impossible, particularly if Adobe Alchemy provides APIs to meet some of those needs.
如果我有一些 OCaml 代码,我想“在浏览器中”运行客户端(这似乎是您基于问题评论的意图),我不得不说我的第一个想法是执行以下操作之一:使用
将 OCaml 编译为 java 字节码并
使用 Java Web Start 或
相似的。
OCaml)在.NET上运行并使用
MS 提供的任何网络部署服务
那。
也许如果我真的很疯狂:
相信是在“C”中实现的)
使用 Alchemy 进行 Flash 并运行
我的原始(未移植)代码的 OCaml 字节码。
不过,两阶段的 OCaml 到 C、C 到 Flash 并不真正有吸引力。
If I had some OCaml code I wanted to run client-side "in the browser" (which seems to be your intent based on comments with the question), I have to say my first thought would be to do one of
compile OCaml to java bytecode and
deploy that using Java web start or
similar.
OCaml) running on .NET and use
whatever MS provides to web-deploy
that.
And maybe if I was really crazy:
believe is implemented in 'C') to
Flash using Alchemy and have it run
the OCaml bytecode of my original (unported) code.
A two-stage OCaml-to-C, C-to-Flash doesn't really appeal though.