GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - bailiyan/gpython: gpython is a python interpreter written in go "batteries not included"

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

396 Commits
396 Commits

Folders and files

NameName
Last commit message
Last commit date
ast
ast
 
 
builtin
builtin
 
 
compile
compile
 
 
examples
examples
 
 
importlib
importlib
 
 
marshal
marshal
 
 
math
math
 
 
parser
parser
 
 
py
py
 
 
pytest
pytest
 
 
repl
repl
 
 
symtable
symtable
 
 
sys
sys
 
 
time
time
 
 
vm
vm
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
main.go
main.go
 
 
notes.txt
notes.txt
 
 
py3test.py
py3test.py
 
 

Repository files navigation

gpython

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)

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

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

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)[https://github.com/python/cpython/blob/master/LICENSE)

About

gpython is a python interpreter written in go "batteries not included"

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.