Skip to content

realyixuan/gsubpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gsubpy

This is an interpreter for subset of Python3 written by golang, which means it will just realize some certain features, some like import, many things will not be implementd. It's intended to be small and simple. (Maybe I will add some features I think cool. At that time, I need give it a new name.)

In a word, gsubpy, a Python interpreter for fun, not big things.

Quickstart

  • install
$ go install github.com/realyixuan/gsubpy@latest
  • running

with repl:

$ gsubpy
>>> print("Hello world")
Hello world 

or with .py file (there are some examples under demos/):

$ gsubpy a_py_file.py

Supporting features:

  • data: int, str, list, dict

  • builtin: print, len, int, str, bool, hash, type, object, id, Exception, StopIteration, list, dict, isinstance, issubclass, iter, next, range, max, min, dir

  • statement: if, while, def, class, return, break, for, break, continue, raise, assert

  • operations:

    • dot operation for your own defined attrs (and some special methods)

    • +-*/

    • >, <, ==, !=

    • not, in, not in, is, is not, and, or

  • function without keyword arguments

  • class without multi-inheritance

Supports

JetBrains Logo (Main) logo.

Reference:

About

An interpreter of subset of Python in Go

Resources

License

Stars

Watchers

Forks

Packages

No packages published