静态类型、可嵌入、可编译的脚本语言
我正在寻找具有以下功能的语言:
- SWIG 兼容或类似。与 C++ 的兼容性应该很容易:
C、C++、AllegroCL、C# - Mono、C# - MS .NET、CFFI、鸡、CLISP、D、Go 、Guile、Java、Lua、 MzScheme/Racket、Ocaml、Octave、Perl、 PHP、Python、R、Ruby、Tcl/Tk
- 静态类型:不像 Lua 中那样 myObject.CompletelyNewFieldWithUnknownSideEffects = GuessWhat()。没有像 php 中那样的 isinstance()。没有像 Python 中那样的 newVariableOfUnknownType = foo() 。最好也是强类型的(“Hello”+“0”而不是“Hello”+0):
C、C++、C#、D、Go、Java、Ocaml、PHP、Ruby?其他?
- 可以在运行时编译(并且 exec("gcc plugin.cpp")!不算!)到任何 asm/中间语言。
C:libCLang,Ch; C++:Ch;任何脚本语言;其他?
- 可以编译(离线或运行时)为 x86 .dll/.so,或 .cpp
C:gcc、libClang 等; C++; C#; D; Python;去;奥卡姆; Lua:LuaJIT;红宝石:可笑
- 最好使用调试器:)
TL;DR
我想要一个静态类型的、可嵌入的脚本语言,可以为性能进行编译。
想法?评论 ?任何类型的输入?谢谢 !
编辑到目前为止有效的建议:
- Java:http://download.oracle.com/javase/6/docs/api/java/lang/Compiler.html
- C#:http://support.microsoft.com/kb/304655/en-us
- C++,由 Ch 解释,用普通编译器编译,希望与 GCC/VC 兼容
- 球拍:http://pre.racket- lang.org/docs/html/inside/overview.html#%28part._embedding%29
所以希望比我原来想象的要多:) 谢谢大家!我将继续调查,并在我对此主题有更多经验时接受答案。
I'm lookign for a langage with the following features :
- SWIG-compatible, or similar. Compatibility with C++ should be easy :
C, C++, AllegroCL, C# - Mono, C# - MS
.NET, CFFI, CHICKEN, CLISP, D, Go
, Guile, Java, Lua,
MzScheme/Racket, Ocaml, Octave, Perl,
PHP, Python, R, Ruby, Tcl/Tk
- Statically typed : No myObject.CompletelyNewFieldWithUnknownSideEffects = GuessWhat() like in Lua. No isinstance() like in php. No newVariableOfUnknownType = foo() like in Python. Preferably strongly typed, too ( "Hello"+"0" rather than "Hello"+0 ) :
C, C++, C#, D, Go, Java, Ocaml, PHP, Ruby ? Other ?
- Can be compiled at runtime ( and exec("gcc plugin.cpp")! doesn't count ! ) into whatever asm/intermediate langage.
C : libCLang, Ch; C++ : Ch; Any scripting langage; Other ?
- Can be compiled (either offline or at runtime) into a x86 .dll/.so, OR .cpp
C : gcc, libClang, etc; C++; C#; D; Python; Go; OCaml; Lua : LuaJIT; Ruby : Ludicrous
- Preferably with debugger :)
TL;DR
I would like a statically typed, embeddable scripting langage which can be compiled for perf.
Ideas ? Comments ? Input of any kind ? Thanks !
EDIT Valid propositions so far :
- Java : http://download.oracle.com/javase/6/docs/api/java/lang/Compiler.html
- C# : http://support.microsoft.com/kb/304655/en-us
- C++, interpreted by Ch, compiled with usual compiler , hopefully compatible with GCC/VC
- Racket : http://pre.racket-lang.org/docs/html/inside/overview.html#%28part._embedding%29
So there is much more hope than I originally thought :) Thank you all ! I'll keep investigating and will accept an answer when I have more experience on the subject.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Ruby 位于您的每个列表中,Rubinius 编译器将其编译为字节码。这满足您的需求吗?第二次尝试:您是否看过 Boo:“静态面向对象公共语言基础设施的类型化编程语言”
Ruby is in each of your lists, and the Rubinius compiler compiles it down to bytecode. Does that meet your needs?2nd try: Have you looked at Boo: "an object oriented statically typed programming language for the Common Language Infrastructure"
或许可以看看 OpenCL?它是围绕在运行时编译的类 C 语言而设计的,但 AMD 最新的 SDK 也提供了离线预编译的功能。
这不是一个明显的选择,因为它被推广为在 GPU 上使用,但它的设计目的是比 GPU 更广泛适用,并且可以在普通 CPU 上运行。
Have a look at OpenCL, perhaps? It's designed around being a C-like language that is compiled at runtime, but AMD's latest SDKs provide the ability to do offline pre-compilation as well.
It's not an obvious choice, because it's promoted for use on GPUs, but it's designed to be more broadly-applicable than that and can be run just as well on ordinary CPUs.
这几乎肯定不是一个有用的答案,但 Java 确实符合您的所有要点。
问题是它不完全是一种脚本语言;你需要编写大量的样板文件才能完成一个小任务,并且 API 通常相当复杂。
This is almost certainly not a useful answer, but Java does actually fit all your bullet points.
The problem is that it's not exactly a scripting language; you need to write quite a lot of boilerplate to get a small task done, and the APIs are usually fairly involved.
我很确定 D 是可编译的并且可以作为脚本运行。
I'm pretty sure D is compilable and can be run as a script.