Erlang 中的 Ruby
是否可以将 Ruby 嵌入到 Erlang 中? Yecc 是正确的工具吗? 如果可以的话,大概需要多少工时?
Is it possible to embed Ruby into Erlang? Would Yecc be the correct tool for that? If it is possible how many man hours would it take, rough estimate?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
Erlectricity 将 Ruby 暴露给 Erlang,反之亦然:
http://github.com/mojombo/erlectricity
Erlectricity exposes Ruby to Erlang and vice versa:
http://github.com/mojombo/erlectricity
Jose Valim 的 url http://elixir-lang.org/ 有一个叫做 Elixir 的东西,它可以让你编写代码类似于 ruby,并在 erlang VM 上运行它。
因此,代码在很多地方看起来都很相似,例如:
in many is more Erlang'y:
和modules =) :
它可以以任何方式帮助您。 我知道 Jose 在不再专注于 Rails 后,最近又开始了大规模的工作。 他可能会获得 Riak 集成和某种 Web 框架。 那可能很有趣!
There is something called Elixir by Jose Valim url http://elixir-lang.org/ this lets you write code that is ruby like and run it on erlang VM.
So code looks similar in many places like:
in many is more Erlang'y:
and modules =) :
It that helps you in any way. I know Jose recently started again massive work on it after he stopped to focus so much on Rails. Probably he will get Riak integration and some sort of a web framework. That could be interesting!
您需要更详细地解释您想要做什么。 在这种情况下,“嵌入”是一个相当模糊的词。
如果您打算在 Erlang 中实现 Ruby 解析器/解释器,那么 Yecc 会是合适的,但我猜这不是您想要做的。
如果你想从 Erlang 调用 Ruby 代码,可以通过类似于 Erlang 的 jinterface 应用程序用于与 Java 对话。 (您也可以google了解该主题。)
您不能期望得到任何结果无需花费一两周的时间就能做出现实的估计,准确地弄清楚应该做什么以及如何做。 否则,你最终会得到“从两个月到两年的时间”,这可能没有多大帮助。
You need to explain in a little more detail what you want to do. "Embed" is a rather vague word in this context.
Yecc would be appropriate if you intended to implement a Ruby-parser/interpreter in Erlang, but I'm guessing this is not what you want to do.
If you want to call Ruby-code from Erlang, this can be done in a manner similar to how Erlang's jinterface application is used to talk to Java. (You can also google on the subject.)
You cannot expect to get any sort of realistic estimate without putting in a week or two of work, figuring out exactly what should be done and how. Otherwise, you'll end up with "anything from 2 months to two years", which probably isn't very helpful.
根据您的具体任务,您可以做一些简单的事情,例如生成一个 ruby 进程以通过 STDIN/OUT 进行通信。
Depending on exactly what your task is, you could could do something as simple as spawning a ruby process to talk to via STDIN/OUT.
如果你想在 Erlang 中评估一些 ruby 代码,你应该准备花大约一年的时间来启动简单的代码。
Ruby 语法非常复杂,而 erlang 有一个非常不同的 VM。
If you wish to evaluate some ruby code inside Erlang, you should prepare to spend about one year to launch simple code.
Ruby syntax is very complicated and erlang has a veeery different VM.