maykeye
maykeye

Reputation: 1316

Programming languages with python-like syntax but native code generation

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.

Upvotes: 32

Views: 21277

Answers (13)

m7mđ ĕğý
m7mđ ĕğý

Reputation: 11

Cython 'Python Compiler' :is a statically typed, compiled language that can be used to write Python code that is as fast as C. Cython code can be compiled to native code or to bytecode that can be executed by the Python interpreter.

Nim 'Similar but Distinct Language ' is a statically typed, compiled language that combines the features of Python, C, and Oberon. Nim generates native code for a variety of platforms, including Windows, Linux, macOS, and FreeBSD.

Rust 'Away Fast' is a statically typed, compiled language that is designed to be safe, fast, and expressive. Rust generates native code for a variety of platforms, including Windows, Linux, macOS, and FreeBSD. Crystal is a statically typed, compiled language that is designed to be fast, safe, and expressive. Crystal generates native code for a variety of platforms, including Windows, Linux, macOS, and FreeBSD.

In addition to these languages, there are a number of other Python-like languages that generate bytecode. These languages can be used to create web applications, mobile applications, and desktop applications. Some of the most popular bytecode-generating languages include:

Jython is a Python implementation that runs on the Java Virtual Machine (JVM).

IronPython is a Python implementation that runs on the .NET Framework.

PyPy is a Python implementation that is designed to be fast and efficient.

Upvotes: 1

pervoj
pervoj

Reputation: 11

You can try Genie. It's the same like Vala, but with Python-like syntax. If you want to develop apps for Linux with GTK, and you want to compile it to native app, Vala or Genie is really good choice.

Upvotes: 1

Andrew
Andrew

Reputation: 7516

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula.

https://nim-lang.org/

Upvotes: 2

Jörg W Mittag
Jörg W Mittag

Reputation: 369624

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.

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

Anyway, Nim 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.

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.

Upvotes: 8

flying sheep
flying sheep

Reputation: 8972

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

Upvotes: 2

Paul Hildebrandt
Paul Hildebrandt

Reputation: 2754

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.

Upvotes: 7

Imran
Imran

Reputation: 91149

shedskin compiles Python to C++

From shedskin project page

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.

Upvotes: 6

Weave
Weave

Reputation: 51

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

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

Upvotes: 5

Dave Kirby
Dave Kirby

Reputation: 26592

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.

Upvotes: 3

PhiLho
PhiLho

Reputation: 41162

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

And Converge too.

Upvotes: 7

jkp
jkp

Reputation: 81340

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

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.

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

HTH

Upvotes: 3

Rad
Rad

Reputation: 8389

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

Upvotes: 1

Alex Martelli
Alex Martelli

Reputation: 882841

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';-).

Upvotes: 14

Related Questions