编程语言具有类似python的语法,但是本机代码生成

时间:2021-08-13 01:12:51

Can anyone point to programming language which has python-like syntax, but from the very beginning was designed to generate native code? I'm aware of Boo only, but it uses .net, not native code generation. Well, if nothing else than python-like languages which generate .net/java bytecode are fine too.

任何人都可以指向具有类似python语法的编程语言,但从一开始就设计用于生成本机代码吗?我只知道Boo,但它使用.net,而不是本机代码生成。好吧,如果没有什么比生成.net / java字节码的类似python的语言也好。

10 个解决方案

#1


Cython might do -- the C code it generates is for Python extensions, but the whole thing can be packaged up and you'll be running native code throughout (after the 'import';-).

Cython可能会这样做 - 它生成的C代码是针对Python扩展的,但整个事情可以打包,你将在整个过程中运行本机代码(在'import'之后;-)。

#2


I must admit that I don't quite understand your question, for two reasons:

我必须承认,我不太明白你的问题,原因有两个:

  1. You are asking for a language with native code generation, but native code generation has nothing to do with the language, it is a trait of the implementation. Every language can have an implementation with native code generation. Several Python implementations have native code generation. There are C compilers that compile to JVM bytecode, CIL bytecode or even ECMAScript sourcecode. There are even C interpreters. There are also compilers that compile Java sourcecode or JVM bytecode to native code.

    您要求使用本机代码生成语言,但本机代码生成与语言无关,它是实现的特征。每种语言都可以使用本机代码生成实现。一些Python实现具有本机代码生成。有C编译器可以编译为JVM字节码,CIL字节码甚至ECMAScript源代码。甚至还有C语言翻译。还有编译器将Java源代码或JVM字节码编译为本机代码。

  2. Why do you care about the syntax? It is probably the least important factor about choosing a programming language.

    你为什么关心语法?这可能是选择编程语言最不重要的因素。

Anyway, Nimrod is a programming language which has an implementation which supports native code generation (or more precisely an implementation which supports C source code generation) and whose syntax is a hybrid between Wirthian style (by the looks of it the most important influences are Oberon and Delphi) and Python.

无论如何,Nimrod是一种编程语言,它具有支持本机代码生成的实现(或者更确切地说是支持C源代码生成的实现),其语法是Wirthian风格的混合(从外观来看,最重要的影响是Oberon和Delphi)和Python。

However, the fact that it has Pythonic syntax isn't going to help you at all if you don't like European style language design or Wirthian style OOP.

但是,如果你不喜欢欧洲风格的语言设计或Wirthian风格的OOP,那么它具有Pythonic语法这一事实根本无法帮助你。

#3


Also found today Delight applying Python syntax on a D back-end.

今天也发现Delight在D后端应用Python语法。

And Converge too.

并且也融合了。

#4


Check out Cobra

看看眼镜蛇

It is strongly influenced by Python, C#, Eiffel, Objective-C and other programming languages. It supports both static and dynamic typing. It has first class support for unit tests and contracts. Cobra provides both rapid development and performance in the same language.

它受到Python,C#,Eiffel,Objective-C和其他编程语言的强烈影响。它支持静态和动态类型。它拥有对单元测试和合同的一流支持。 Cobra以同一种语言提供快速开发和性能。

#5


shedskin compiles Python to C++

shedskin将Python编译为C ++

From shedskin project page

来自shedskin项目页面

Shed Skin is an experimental compiler, that can translate pure, but implicitly statically typed Python programs into optimized C++. It can generate stand-alone programs or extension modules that can be imported and used in larger Python programs.

Shed Skin是一个实验性编译器,可以将纯粹但隐式静态类型的Python程序转换为优化的C ++。它可以生成可以在较大的Python程序中导入和使用的独立程序或扩展模块。

#6


Genie which is part of the gnome project: http://live.gnome.org/Genie

Genie是gnome项目的一部分:http://live.gnome.org/Genie

I think it's exactly what you're looking for.

我认为这正是你要找的。

#7


If you are happy with something that compiles down to Java bytecode you could have a look at Jython. Quoting from their FAQ:

如果您对编译为Java字节码的内容感到满意,可以查看Jython。引用他们的常见问题解答:

JPython is an implementation of the Python programming language which is designed to run on the Java(tm) Platform. It consists of a compiler to compile Python source code down to Java bytecodes which can run directly on a JVM, a set of support libraries which are used by the compiled Java bytecodes, and extra support to make it trivial to use Java packages from within JPython.

JPython是Python编程语言的一种实现,旨在在Java(tm)平台上运行。它包含一个编译器,用于将Python源代码编译为可直接在JVM上运行的Java字节码,一组由编译的Java字节码使用的支持库,以及额外的支持,使得在JPython中使用Java包变得微不足道。

I've not actually used it yet but am considering it on some projects where I have to integrate with existing an Java codebase.

我还没有真正使用它,但我正在考虑一些项目,我必须与现有的Java代码库集成。

HTH

#8


PyPy is a project to re-implement Python in Python. One of it's goals is to allow the use of multiple back-ends, including C. So you can take a pure Python program, convert it to C and compile it to native code. It is still a work in progress, so probably not suitable for production code.

PyPy是一个用Python重新实现Python的项目。其中一个目标是允许使用多个后端,包括C.因此,您可以使用纯Python程序,将其转换为C并将其编译为本机代码。它仍在进行中,因此可能不适合生产代码。

#9


You can find all of the previously mentioned languages, plus some more, here: http://wiki.python.org/moin/PythonImplementations

你可以在这里找到所有前面提到的语言,还有更多语言:http://wiki.python.org/moin/PythonImplementations

#10


You can also investigate IronPython - a python inplementation on the .NET framework

您还可以研究IronPython - .NET框架上的python inplementation

#1


Cython might do -- the C code it generates is for Python extensions, but the whole thing can be packaged up and you'll be running native code throughout (after the 'import';-).

Cython可能会这样做 - 它生成的C代码是针对Python扩展的,但整个事情可以打包,你将在整个过程中运行本机代码(在'import'之后;-)。

#2


I must admit that I don't quite understand your question, for two reasons:

我必须承认,我不太明白你的问题,原因有两个:

  1. You are asking for a language with native code generation, but native code generation has nothing to do with the language, it is a trait of the implementation. Every language can have an implementation with native code generation. Several Python implementations have native code generation. There are C compilers that compile to JVM bytecode, CIL bytecode or even ECMAScript sourcecode. There are even C interpreters. There are also compilers that compile Java sourcecode or JVM bytecode to native code.

    您要求使用本机代码生成语言,但本机代码生成与语言无关,它是实现的特征。每种语言都可以使用本机代码生成实现。一些Python实现具有本机代码生成。有C编译器可以编译为JVM字节码,CIL字节码甚至ECMAScript源代码。甚至还有C语言翻译。还有编译器将Java源代码或JVM字节码编译为本机代码。

  2. Why do you care about the syntax? It is probably the least important factor about choosing a programming language.

    你为什么关心语法?这可能是选择编程语言最不重要的因素。

Anyway, Nimrod is a programming language which has an implementation which supports native code generation (or more precisely an implementation which supports C source code generation) and whose syntax is a hybrid between Wirthian style (by the looks of it the most important influences are Oberon and Delphi) and Python.

无论如何,Nimrod是一种编程语言,它具有支持本机代码生成的实现(或者更确切地说是支持C源代码生成的实现),其语法是Wirthian风格的混合(从外观来看,最重要的影响是Oberon和Delphi)和Python。

However, the fact that it has Pythonic syntax isn't going to help you at all if you don't like European style language design or Wirthian style OOP.

但是,如果你不喜欢欧洲风格的语言设计或Wirthian风格的OOP,那么它具有Pythonic语法这一事实根本无法帮助你。

#3


Also found today Delight applying Python syntax on a D back-end.

今天也发现Delight在D后端应用Python语法。

And Converge too.

并且也融合了。

#4


Check out Cobra

看看眼镜蛇

It is strongly influenced by Python, C#, Eiffel, Objective-C and other programming languages. It supports both static and dynamic typing. It has first class support for unit tests and contracts. Cobra provides both rapid development and performance in the same language.

它受到Python,C#,Eiffel,Objective-C和其他编程语言的强烈影响。它支持静态和动态类型。它拥有对单元测试和合同的一流支持。 Cobra以同一种语言提供快速开发和性能。

#5


shedskin compiles Python to C++

shedskin将Python编译为C ++

From shedskin project page

来自shedskin项目页面

Shed Skin is an experimental compiler, that can translate pure, but implicitly statically typed Python programs into optimized C++. It can generate stand-alone programs or extension modules that can be imported and used in larger Python programs.

Shed Skin是一个实验性编译器,可以将纯粹但隐式静态类型的Python程序转换为优化的C ++。它可以生成可以在较大的Python程序中导入和使用的独立程序或扩展模块。

#6


Genie which is part of the gnome project: http://live.gnome.org/Genie

Genie是gnome项目的一部分:http://live.gnome.org/Genie

I think it's exactly what you're looking for.

我认为这正是你要找的。

#7


If you are happy with something that compiles down to Java bytecode you could have a look at Jython. Quoting from their FAQ:

如果您对编译为Java字节码的内容感到满意,可以查看Jython。引用他们的常见问题解答:

JPython is an implementation of the Python programming language which is designed to run on the Java(tm) Platform. It consists of a compiler to compile Python source code down to Java bytecodes which can run directly on a JVM, a set of support libraries which are used by the compiled Java bytecodes, and extra support to make it trivial to use Java packages from within JPython.

JPython是Python编程语言的一种实现,旨在在Java(tm)平台上运行。它包含一个编译器,用于将Python源代码编译为可直接在JVM上运行的Java字节码,一组由编译的Java字节码使用的支持库,以及额外的支持,使得在JPython中使用Java包变得微不足道。

I've not actually used it yet but am considering it on some projects where I have to integrate with existing an Java codebase.

我还没有真正使用它,但我正在考虑一些项目,我必须与现有的Java代码库集成。

HTH

#8


PyPy is a project to re-implement Python in Python. One of it's goals is to allow the use of multiple back-ends, including C. So you can take a pure Python program, convert it to C and compile it to native code. It is still a work in progress, so probably not suitable for production code.

PyPy是一个用Python重新实现Python的项目。其中一个目标是允许使用多个后端,包括C.因此,您可以使用纯Python程序,将其转换为C并将其编译为本机代码。它仍在进行中,因此可能不适合生产代码。

#9


You can find all of the previously mentioned languages, plus some more, here: http://wiki.python.org/moin/PythonImplementations

你可以在这里找到所有前面提到的语言,还有更多语言:http://wiki.python.org/moin/PythonImplementations

#10


You can also investigate IronPython - a python inplementation on the .NET framework

您还可以研究IronPython - .NET框架上的python inplementation