静态类型、可嵌入、可编译的脚本语言

发布于 2024-11-05 16:44:32 字数 1637 浏览 5 评论 0原文

我正在寻找具有以下功能的语言:

  • 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

我想要一个静态类型的、可嵌入的脚本语言,可以为性能进行编译。

想法?评论 ?任何类型的输入?谢谢 !

编辑到目前为止有效的建议:

所以希望比我原来想象的要多:) 谢谢大家!我将继续调查,并在我对此主题有更多经验时接受答案。

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 :

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

屋顶上的小猫咪 2024-11-12 16:44:32

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"

送君千里 2024-11-12 16:44:32

或许可以看看 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.

请帮我爱他 2024-11-12 16:44:32

这几乎肯定不是一个有用的答案,但 Java 确实符合您的所有要点。

  • 您可以使用 JNI、JNA 或 SWIG 与本机代码交互。
  • 无需博士学位即可实现静态类型
  • 可以通过 编译器 API
  • 在运行时由一些优秀的编译器编译为本机代码(也有离线编译器)
  • 有许多调试器

问题是它不完全是一种脚本语言;你需要编写大量的样板文件才能完成一个小任务,并且 API 通常相当复杂。

This is almost certainly not a useful answer, but Java does actually fit all your bullet points.

  • You can talk to native code with JNI, JNA, or SWIG.
  • As statically typed as it gets without needing a PhD
  • Can be compiled at runtime through the compiler API
  • Is compiled to native code at runtime by some excellent compilers (and there are offline compilers too)
  • Has a number of debuggers

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.

南城旧梦 2024-11-12 16:44:32

我很确定 D 是可编译的并且可以作为脚本运行。

I'm pretty sure D is compilable and can be run as a script.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文