All Projects → go-python → Gpython

go-python / Gpython

Licence: bsd-3-clause
gpython is a python interpreter written in go "batteries not included"

Programming Languages

python
139335 projects - #7 most used programming language
go
31211 projects - #10 most used programming language
golang
3204 projects
python3
1442 projects

Projects that are alternatives of or similar to Gpython

V8
The official mirror of the V8 Git repository
Stars: ✭ 18,808 (+3884.75%)
Mutual labels:  interpreter
Sh
A shell parser, formatter, and interpreter with bash support; includes shfmt
Stars: ✭ 4,343 (+820.13%)
Mutual labels:  interpreter
Enso
Hybrid visual and textual functional programming.
Stars: ✭ 5,238 (+1009.75%)
Mutual labels:  interpreter
Wasm3
🚀 The fastest WebAssembly interpreter, and the most universal runtime
Stars: ✭ 4,375 (+826.91%)
Mutual labels:  interpreter
Tcl
The Tcl Core. (Mirror of core.tcl-lang.org)
Stars: ✭ 342 (-27.54%)
Mutual labels:  interpreter
Picrin
lightweight scheme interpreter
Stars: ✭ 387 (-18.01%)
Mutual labels:  interpreter
Pycparser
C parser and interpreter written in Python with automatic ctypes interface generation
Stars: ✭ 320 (-32.2%)
Mutual labels:  interpreter
Neko
The Neko Virtual Machine
Stars: ✭ 447 (-5.3%)
Mutual labels:  interpreter
Monkey
Interpreter with support for class, linq, sql, net, http, fmt, json and A realtime syntax highlighting REPL.
Stars: ✭ 347 (-26.48%)
Mutual labels:  interpreter
Ok
An open-source interpreter for the K5 programming language.
Stars: ✭ 408 (-13.56%)
Mutual labels:  interpreter
Passerine
A small extensible programming language designed for concise expression with little code.
Stars: ✭ 341 (-27.75%)
Mutual labels:  interpreter
Vm.js
Javascript 解释器. Javascript Interpreter
Stars: ✭ 343 (-27.33%)
Mutual labels:  interpreter
Mirth
Compiler for the Mirth programming language.
Stars: ✭ 390 (-17.37%)
Mutual labels:  interpreter
Yaegi
Yaegi is Another Elegant Go Interpreter
Stars: ✭ 4,044 (+756.78%)
Mutual labels:  interpreter
Ph7
An Embedded Implementation of PHP (C Library)
Stars: ✭ 422 (-10.59%)
Mutual labels:  interpreter
Craftinginterpreters
Repository for the book "Crafting Interpreters"
Stars: ✭ 4,298 (+810.59%)
Mutual labels:  interpreter
Plam
An interpreter for learning and exploring pure λ-calculus
Stars: ✭ 385 (-18.43%)
Mutual labels:  interpreter
Renjin
JVM-based interpreter for the R language for the statistical analysis.
Stars: ✭ 466 (-1.27%)
Mutual labels:  interpreter
Engine262
An implementation of ECMA-262 in JavaScript
Stars: ✭ 445 (-5.72%)
Mutual labels:  interpreter
Gravity
Gravity Programming Language
Stars: ✭ 3,968 (+740.68%)
Mutual labels:  interpreter

gpython

Build Status codecov GoDoc License

gpython is a part re-implementation / part port of the Python 3.4 interpreter to the Go language, "batteries not included".

It includes:

  • runtime - using compatible byte code to python3.4
  • lexer
  • parser
  • compiler
  • interactive mode (REPL) (try online!)

It does not include very many python modules as many of the core modules are written in C not python. The converted modules are:

  • builtins
  • marshal
  • math
  • time
  • sys

Install

Gpython is a Go program and comes as a single binary file.

Download the relevant binary from here: https://github.com/go-python/gpython/releases

Or alternatively if you have Go installed use

go get github.com/go-python/gpython

and this will build the binary in $GOPATH/bin. You can then modify the source and submit patches.

Objectives

Gpython was written as a learning experiment to investigate how hard porting Python to Go might be. It turns out that all those C modules are a significant barrier to making a fully functional port.

Status

The project works well enough to parse all the code in the python 3.4 distribution and to compile and run python 3 programs which don't depend on a module gpython doesn't support.

See the examples directory for some python programs which run with gpython.

Speed hasn't been a goal of the conversions however it runs pystone at about 20% of the speed of cpython. The pi test runs quicker under gpython as I think the Go long integer primitives are faster than the Python ones.

There are many directions this project could go in. I think the most profitable would be to re-use the grumpy runtime (which would mean changing the object model). This would give access to the C modules that need to be ported and would give grumpy access to a compiler and interpreter (gpython does support eval for instance).

I (@ncw) haven't had much time to work on gpython (I started it in 2013 and have worked on it very sporadically) so someone who wants to take it in the next direction would be much appreciated.

Limitations and Bugs

Lots!

Similar projects

  • grumpy - a python to go transpiler

Community

You can chat with the go-python community (or which gpython is part) at [email protected] or on the Gophers Slack in the #go-python channel.

License

This is licensed under the MIT licence, however it contains code which was ported fairly directly directly from the cpython source code under the PSF LICENSE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].
OSZAR »