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

Overview

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.

Comments
  • Add OS module

    Add OS module

    OS Module

    I added some of the basic functions/globals of the OS module, these include;

    • Functions
      • os.getcwd()
      • os.getcwdb()
      • os.chdir()
      • os.getenv()
      • os.getpid()
      • os.putenv()
      • os.unsetenv()
      • os._exit()
      • os.system()
    • Globals
      • os.error
      • os.environ

    I also added a py.Println function, in which you can find the definition for in py/utils.py. It looks something like this

    func Println(self Object, args ...string) (int,error)
    

    This is my first contribution to gpython, so please give me feedback and other things I should add. The first two commits were tests i made to figure out how to create a module; I was going to make a JSON module, but then I saw that gpython didnt have an OS module, and I thought that was more important than a JSON module at this time. I've also included os.test.py, a file which you can run with gpython to check if the OS module is working properly.

    Thanks!

    opened by glaukiol1 22
  • Multi-context execution (py.Context)

    Multi-context execution (py.Context)

    Hi Seb, it's a been a couple months but things are well here.

    With this PR, I am pleased to share gpython with multi-context execution! Check out type Context interface and vm/vm_test.go for a quick start.

    My intention with this PR is get feedback from you on what you want me to alter or massage so that you are satisfied. I am totally open if you want me to shift, rename, or organize code in ways that you would prefer, so kindly please just let me know. I think many will be highly interested in a multi-ctx gpython (as many have asked for it as you already know).

    So if you like things as they are, you can merge this PR. Otherwise, just give me a list of things you want changed and I'll resubmit a new PR with that. Or, perhaps merge this PR as is, insert edits as you see fit, tag it into a new release and version, and then I will follow your lead and ditch my fork and we can be on our way. :)

    We are definitely using gpython here for our classified particle research project and would love to join forces with you on maintaining gpython. I think it is highly reasonable, especially with this PR, that gpython is picked up (sponsored) since it serves the Google, Python, and Go communities quite uniquely.

    opened by drew-512 18
  • Fix comments in REPL - fixes #78

    Fix comments in REPL - fixes #78

    Before this change, entering a comment in the REPL caused the REPL to read the comment indefinitely effectively breaking it.

    After this change the behaviour should be exactly the same as python3/

    opened by ncw 10
  • Embedding Go objects

    Embedding Go objects

    Hi friends, love gpython and would be into contributing. I'm looking to expose a particle physics Go module that I maintain via a module in gpython. Problem is, Objects in gpython only offer embedded Go methods. Yes, I suppose I could make a new closure for each Go struct/interface to embed, but we can all agree that is painfully wasteful.

    If someone here can give me some guidance on how to approach this, I'd be into adding this code. This physics module is rerally exciting and we expect it to get some major traction in the physics community (the LHC for starters) -- and I'd much rather use gpython than lua!

    opened by drew-512 8
  • builtin: Update builtin_all and builtin_any for Python3

    builtin: Update builtin_all and builtin_any for Python3

    Update builtin_all and builtin_any for Python3 reference:

    • https://docs.python.org/3/library/functions.html#all
    • https://docs.python.org/3/library/functions.html#any

    Fixes: https://github.com/go-python/gpython/issues/14

    opened by corona10 8
  • Improve some things around how errors are reported when parsing a file

    Improve some things around how errors are reported when parsing a file

    Given the malformed input "/Users/jpoole/gpython/test.py":

    def foo(name : str):
        return name
    
    foo(
    
    
    foo(name = "test"))
    
    foo(
    
    

    Before:

    Exception &py.Exception{Base:(*py.Type)(0xc00012dc20), Args:py.Tuple{"invalid syntax"}, Traceback:py.Object(nil), Context:py.Object(nil), Cause:py.Object(nil), SuppressContext:false, Dict:py.StringDict{"filename":"<string>", "line":"", "lineno":10, "offset":0}}
    -- No traceback available --
    2022/04/10 18:31:19 
      File "<string>", line 10, offset 0
        
    
    SyntaxError: 'invalid syntax'
    

    After

    Exception 
      File "/Users/jpoole/gpython/test.py", line 10, offset 0
        
    
    SyntaxError: 'unexpected EOF while parsing'
    -- No traceback available --
    
    
    opened by Tatskaari 7
  • Errors are suppressed in generator comprehensions

    Errors are suppressed in generator comprehensions

    >>> list(i for x in range(10))
    []
    

    Which should have output

    >>> list(i for x in range(10))
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "<stdin>", line 1, in <genexpr>
    NameError: name 'i' is not defined
    
    bug 
    opened by ncw 7
  • Implement set operation

    Implement set operation

    These operations should be implemented

    >>> a = {1, 2, 3}
    >>> b = {2, 3, 4, 5}
    >>> a | b
    {1, 2, 3, 4, 5}
    >>> a & b
    {2, 3}
    >>> a - b
    {1}
    >>> a ^ b
    {1, 4, 5}
    >>>
    
    Contributhon2019 
    opened by corona10 6
  • SyntaxError of global declaration don't stop program

    SyntaxError of global declaration don't stop program

    a = 3
    global a
    print(a)
    
    b = 2 + 5
    print(b)
    

    This code generate syntax error, but gpython doesn't stop program

    Expected Result

    Hyeockz:bin hyeockjinkim$ python3 g.py 
      File "g.py", line 2
        global a
    SyntaxError: name 'a' is assigned to before global declaration
    

    Actual Result

    2019/09/09 00:08:36 name 'a' is assigned to before global declaration
    3
    7
    

    SyntaxError in python3 is Error, not warning. So I think it should be modified.

    bug Contributhon2019 
    opened by HyeockJinKim 6
  • builtin: Implement builtin function any, all.

    builtin: Implement builtin function any, all.

    Hi, I have highly interested in this project. I've experienced to work on the grumpy project also.

    Anyway, this might be my first PR, Please take a look.

    opened by corona10 6
  • How would i go about writing a new module?

    How would i go about writing a new module?

    Hi

    I want to contribute to this project by writing a module; specifically the JSON module (the one that is in python's standard library). I have seen the source code and have an idea of how I should go about this. So my question is; do I create a folder and put the .go file in there? Something like json/json.go? Also any tips on writing modules would help, thanks!

    opened by glaukiol1 5
  • How to get `globals()` inside Go bounded method?

    How to get `globals()` inside Go bounded method?

    Simple description

    I cannot find a way to access globals() within a bounded method in GoLang.

    I expose a type into module, like moduleImpl.Globals["Foo"] = FooType, and add methods to FooType by FooType.Globals["bar"] = MustNewMethod(..., someGoMethod, ...).

    I cannot access module's global variables inside someGoMethod.

    Why I need this feature

    I just attach different zap.Logger to multiple py.Contexts. I attach logger as a module's global variable, by using

    ctx.GetModule("name").Globals["logger"] = &pyLoggerObject{logger}
    

    but I cannot find a way to use this logger inside bounded methods.


    I found I can create a py.Type and attach the type to module global dynamically. I can somehow read module globals by this trick. But Is there a elegant way to archive that?

    m = ctx.GetModule("module")
    m.Globals["Foo"] = NewFooType(m)
    
    opened by reyoung 0
  • Compiling long operations crashes gpython

    Compiling long operations crashes gpython

    Taking long operations as argument of compiler() leads that pointer gets access to unused region crashing gpython

    test.py compile('1'+'<2'*100000000,'','exec')

    Output on go/wasm(https://gpython.org/?wasm):

    Gpython 3.4.0 running in your browser with go/wasm
    >>> compile('1'+'<2'*100000000,'','exec')
    runtime: pointer 0x1e8b0000 to unused region of span span.base()=0xc538000 span.limit=0x183f4200 span.state=1
    fatal error: found bad pointer in Go heap (incorrect use of unsafe or cgo?)
    runtime stack:
    runtime.throw(0x71c31, 0x3e)
        /opt/go/go1.11/src/runtime/panic.go:608 +0x6 fp=0x36a280 sp=0x36a258 pc=0x11c60006
    runtime.findObject(0x1e8b0000, 0x0, 0x0, 0x0, 0x0, 0x0)
        /opt/go/go1.11/src/runtime/mbitmap.go:399 +0x42 fp=0x36a2c8 sp=0x36a280 pc=0x10f50042
    runtime.wbBufFlush1(0xc010000)
        /opt/go/go1.11/src/runtime/mwbbuf.go:252 +0x16 fp=0x36a348 sp=0x36a2c8 pc=0x11a90016
    runtime.gcMarkDone.func1.1(0xc010000)
        /opt/go/go1.11/src/runtime/mgc.go:1449 +0x2 fp=0x36a358 sp=0x36a348 pc=0x13290002
    runtime.forEachP(0x7aa20)
        /opt/go/go1.11/src/runtime/proc.go:1452 +0x25 fp=0x36a3c0 sp=0x36a358 pc=0x12090025
    runtime.gcMarkDone.func1()
        /opt/go/go1.11/src/runtime/mgc.go:1448 +0x2 fp=0x36a3d0 sp=0x36a3c0 pc=0x132a0002
    runtime.systemstack(0x36a410)
        /opt/go/go1.11/src/runtime/asm_wasm.s:171 +0x2 fp=0x36a3d8 sp=0x36a3d0 pc=0x13590002
    runtime.mstart()
        /opt/go/go1.11/src/runtime/proc.go:1229 fp=0x36a3e0 sp=0x36a3d8 pc=0x12050000
    goroutine 5 [running]:
    runtime.systemstack_switch()
        /opt/go/go1.11/src/runtime/asm_wasm.s:182 fp=0xc07b6e8 sp=0xc07b6e0 pc=0x135a0000
    runtime.gcMarkDone()
        /opt/go/go1.11/src/runtime/mgc.go:1442 +0xc fp=0xc07b710 sp=0xc07b6e8 pc=0x1127000c
    runtime.gcAssistAlloc(0xc000780)
        /opt/go/go1.11/src/runtime/mgcmark.go:476 +0x23 fp=0xc07b770 sp=0xc07b710 pc=0x11410023
    runtime.mallocgc(0xbebc201, 0x0, 0x2c979d00, 0x13380002)
        /opt/go/go1.11/src/runtime/malloc.go:807 +0x9b fp=0xc07b818 sp=0xc07b770 pc=0x10b2009b
    runtime.rawstring(0xbebc201, 0x0, 0x0, 0x0, 0x0, 0x0)
        /opt/go/go1.11/src/runtime/string.go:258 +0x2 fp=0xc07b840 sp=0xc07b818 pc=0x129e0002
    runtime.rawstringtmp(0x0, 0xbebc201, 0x19a30001, 0x328040, 0x130f0002, 0x5a020, 0xde40)
        /opt/go/go1.11/src/runtime/string.go:123 +0x7 fp=0xc07b878 sp=0xc07b840 pc=0x12990007
    runtime.concatstrings(0x0, 0xc07b950, 0x2, 0x2, 0x20de3, 0x3d120)
        /opt/go/go1.11/src/runtime/string.go:49 +0x11 fp=0xc07b910 sp=0xc07b878 pc=0x12930011
    runtime.concatstring2(0x0, 0x3262d1, 0x1, 0xc538000, 0xbebc200, 0x366168, 0x0)
        /opt/go/go1.11/src/runtime/string.go:58 +0x2 fp=0xc07b948 sp=0xc07b910 pc=0x12940002
    github.com/go-python/gpython/py.String.M__add__(0x3262d1, 0x1, 0x9d740, 0xc00e010, 0x3d120, 0x5a020, 0x1, 0x2c9345a0)
        /home/ncw/go/src/github.com/go-python/gpython/py/string.go:135 +0x5 fp=0xc07b998 sp=0xc07b948 pc=0x1d160005
    github.com/go-python/gpython/py.(*String).M__add__(0xc00f960, 0x9d740, 0xc00e010, 0x2c9345a0, 0xc00f960, 0x1, 0x0)
        <autogenerated>:1 +0x3 fp=0xc07b9e0 sp=0xc07b998 pc=0x1e8b0003
    github.com/go-python/gpython/py.Add(0x9d740, 0xc00f960, 0x9d740, 0xc00e010, 0x9d740, 0xc00e010, 0x0, 0x0)
        /home/ncw/go/src/github.com/go-python/gpython/py/arithmetic.go:174 +0x1d fp=0xc07ba70 sp=0xc07b9e0 pc=0x1b3e001d
    github.com/go-python/gpython/vm.do_BINARY_ADD(0xc074930, 0x2, 0x0, 0x0)
        /home/ncw/go/src/github.com/go-python/gpython/vm/eval.go:277 +0xc fp=0xc07bac0 sp=0xc07ba70 pc=0x214e000c
    github.com/go-python/gpython/vm.RunFrame(0xc0de0b0, 0x0, 0xc07bd18, 0x0, 0x0)
        /home/ncw/go/src/github.com/go-python/gpython/vm/eval.go:1785 +0x3f fp=0xc07bba0 sp=0xc07bac0 pc=0x21ad003f
    github.com/go-python/gpython/vm.EvalCodeEx(0xc04c200, 0xc062db0, 0xc062db0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/ncw/go/src/github.com/go-python/gpython/vm/eval.go:2162 +0xa3 fp=0xc07bd80 sp=0xc07bba0 pc=0x21b100a3
    github.com/go-python/gpython/vm.Run(0xc062db0, 0xc062db0, 0xc04c200, 0x0, 0x0, 0x0, 0x0, 0x1, 0x9d240, 0xc04c200)
        /home/ncw/go/src/github.com/go-python/gpython/vm/eval.go:2182 +0x2 fp=0xc07be18 sp=0xc07bd80 pc=0x21b30002
    github.com/go-python/gpython/repl.(*REPL).Run(0xc09a6c0, 0xc038330, 0x25)
        /home/ncw/go/src/github.com/go-python/gpython/repl/repl.go:99 +0x20 fp=0xc07bf28 sp=0xc07be18 pc=0x229f0020
    main.main.func1(0xc01e3f0, 0x2, 0x2)
        /home/ncw/go/src/github.com/go-python/gpython/repl/web/main.go:82 +0x4 fp=0xc07bf50 sp=0xc07bf28 pc=0x22db0004
    syscall/js.callbackLoop()
        /opt/go/go1.11/src/syscall/js/callback.go:116 +0x7 fp=0xc07bfe0 sp=0xc07bf50 pc=0x14dd0007
    runtime.goexit()
        /opt/go/go1.11/src/runtime/asm_wasm.s:425 +0x1 fp=0xc07bfe8 sp=0xc07bfe0 pc=0x13800001
    created by syscall/js.NewCallback.func1
        /opt/go/go1.11/src/syscall/js/callback.go:40 +0x2
    goroutine 1 [select (no cases)]:
    runtime.gopark(0x0, 0x0, 0x6100a, 0x1)
        /opt/go/go1.11/src/runtime/proc.go:302 +0x18 fp=0xc05ae98 sp=0xc05ae70 pc=0x11e30018
    runtime.block()
        /opt/go/go1.11/src/runtime/select.go:102 +0x2 fp=0xc05aec0 sp=0xc05ae98 pc=0x126a0002
    main.main()
        /home/ncw/go/src/github.com/go-python/gpython/repl/web/main.go:100 +0x34 fp=0xc05afa0 sp=0xc05aec0 pc=0x22da0034
    runtime.main()
        /opt/go/go1.11/src/runtime/proc.go:201 +0x1f fp=0xc05afe0 sp=0xc05afa0 pc=0x11de001f
    runtime.goexit()
        /opt/go/go1.11/src/runtime/asm_wasm.s:425 +0x1 fp=0xc05afe8 sp=0xc05afe0 pc=0x13800001
    goroutine 2 [force gc (idle)]:
    runtime.gopark(0x7ab30, 0x34ac00, 0x1410, 0x1)
        /opt/go/go1.11/src/runtime/proc.go:302 +0x18 fp=0xc024f90 sp=0xc024f68 pc=0x11e30018
    runtime.goparkunlock(0x34ac00, 0x1410, 0x1)
        /opt/go/go1.11/src/runtime/proc.go:308 +0x2 fp=0xc024fb8 sp=0xc024f90 pc=0x11e40002
    runtime.forcegchelper()
        /opt/go/go1.11/src/runtime/proc.go:251 +0xb fp=0xc024fe0 sp=0xc024fb8 pc=0x11e1000b
    runtime.goexit()
        /opt/go/go1.11/src/runtime/asm_wasm.s:425 +0x1 fp=0xc024fe8 sp=0xc024fe0 pc=0x13800001
    created by runtime.init.3
        /opt/go/go1.11/src/runtime/proc.go:240 +0x2
    goroutine 3 [runnable]:
    runtime.Gosched()
        /opt/go/go1.11/src/runtime/proc.go:267 +0x3 fp=0xc0257b8 sp=0xc0257a8 pc=0x11e20003
    runtime.bgsweep(0xc02c000)
        /opt/go/go1.11/src/runtime/mgcsweep.go:57 +0x8 fp=0xc0257d8 sp=0xc0257b8 pc=0x11540008
    runtime.goexit()
        /opt/go/go1.11/src/runtime/asm_wasm.s:425 +0x1 fp=0xc0257e0 sp=0xc0257d8 pc=0x13800001
    created by runtime.gcenable
        /opt/go/go1.11/src/runtime/mgc.go:216 +0x3
    goroutine 4 [finalizer wait]:
    runtime.gopark(0x7ab30, 0x366158, 0x140f, 0x1)
        /opt/go/go1.11/src/runtime/proc.go:302 +0x18 fp=0xc025f30 sp=0xc025f08 pc=0x11e30018
    runtime.goparkunlock(0x366158, 0x140f, 0x1)
        /opt/go/go1.11/src/runtime/proc.go:308 +0x2 fp=0xc025f58 sp=0xc025f30 pc=0x11e40002
    runtime.runfinq()
        /opt/go/go1.11/src/runtime/mfinal.go:175 +0x7 fp=0xc025fe0 sp=0xc025f58 pc=0x11140007
    runtime.goexit()
        /opt/go/go1.11/src/runtime/asm_wasm.s:425 +0x1 fp=0xc025fe8 sp=0xc025fe0 pc=0x13800001
    created by runtime.createfing
        /opt/go/go1.11/src/runtime/mfinal.go:156 +0x8
    goroutine 6 [GC worker (idle)]:
    runtime.gopark(0x7aa10, 0xc01e500, 0xffff1417, 0x0)
        /opt/go/go1.11/src/runtime/proc.go:302 +0x18 fp=0xc024760 sp=0xc024738 pc=0x11e30018
    runtime.gcBgMarkWorker(0xc010000)
        /opt/go/go1.11/src/runtime/mgc.go:1772 +0x12 fp=0xc0247d8 sp=0xc024760 pc=0x112a0012
    runtime.goexit()
        /opt/go/go1.11/src/runtime/asm_wasm.s:425 +0x1 fp=0xc0247e0 sp=0xc0247d8 pc=0x13800001
    created by runtime.gcBgMarkStartWorkers
        /opt/go/go1.11/src/runtime/mgc.go:1720 +0xc
    
    opened by xiaxinmeng 3
  • Taking large arguments in functions crashes gpython

    Taking large arguments in functions crashes gpython

    The following example takes large arguments and then crashes gpython.

    test.py

    def f(*args, **kwargs):
        return (len(args), len(kwargs))
    f(*[0] * (2 ** 32 + 1))
    

    Output on go/wasm(https://gpython.org/?wasm):

    Gpython 3.4.0 running in your browser with gopherjs
    >>> def f(*args, **kwargs):
    ...     return (len(args), len(kwargs))
    ... 
    >>> f(*[0] * (2 ** 32 + 1))
    [USER]: https://gpython.org/gpython.js: runtime error: invalid memory address or nil pointer dereference
    $callDeferred@https://gpython.org/gpython.js:4:22511
    $panic@https://gpython.org/gpython.js:4:22957
    AK@https://gpython.org/gpython.js:10:2429
    $throwNilPointerError@https://gpython.org/gpython.js:4:504
    get@https://gpython.org/gpython.js:4:4514
    BL.ptr.prototype.Exp@https://gpython.org/gpython.js:38:95685
    BH.ptr.prototype.pow@https://gpython.org/gpython.js:41:102703
    BH.ptr.prototype.M__pow__@https://gpython.org/gpython.js:41:103772
    EQ.prototype.M__pow__@https://gpython.org/gpython.js:41:236439
    AZ@https://gpython.org/gpython.js:41:73603
    V@https://gpython.org/gpython.js:44:18787
    DO@https://gpython.org/gpython.js:44:91592
    DU@https://gpython.org/gpython.js:44:107450
    DW@https://gpython.org/gpython.js:44:109015
    G.ptr.prototype.Run@https://gpython.org/gpython.js:56:3575
    $b@https://gpython.org/gpython.js:60:3908
    $b@https://gpython.org/gpython.js:59:2625
    r@https://gpython.org/gpython.js:4:23443
    $runScheduled@https://gpython.org/gpython.js:4:24007
    $schedule@https://gpython.org/gpython.js:4:24184
    $go@https://gpython.org/gpython.js:4:23907
    I/$packages["github.com/gopherjs/gopherwasm/js"]<@https://gpython.org/gpython.js:59:2240
    $externalizeFunction/e.$externalizeWrapper@https://gpython.org/gpython.js:4:28925
    a@https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/1.23.2/js/jquery.terminal.min.js:40:82615
    k@https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/1.23.2/js/jquery.terminal.min.js:40:83463
    ENTER@https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/1.23.2/js/jquery.terminal.min.js:40:14915
    $e@https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/1.23.2/js/jquery.terminal.min.js:40:28362
    dispatch@https://code.jquery.com/jquery-latest.js:4641:9
    add/elemData.handle@https://code.jquery.com/jquery-latest.js:4309:28
    

    output with gopherjs(https://gpython.org/):

    Gpython 3.4.0 running in your browser with go/wasm
    >>> def f(*args, **kwargs): return (len(args), len(kwargs))
    >>> f(*[0] * (2 ** 32 + 1))
    panic: runtime error: makeslice: len out of range
    goroutine 5 [running]:
    github.com/go-python/gpython/py.NewListSized(...)
        /home/ncw/go/src/github.com/go-python/gpython/py/list.go:52
    github.com/go-python/gpython/py.(*List).M__mul__(0xc05eba0, 0x9d6e0, 0xc01e568, 0x2c931ef0, 0xc05eba0, 0x1, 0x0)
        /home/ncw/go/src/github.com/go-python/gpython/py/list.go:239 +0x13
    github.com/go-python/gpython/py.Mul(0x9d340, 0xc05eba0, 0x9d6e0, 0xc01e568, 0x9d6e0, 0xc01e568, 0x0, 0x0)
        /home/ncw/go/src/github.com/go-python/gpython/py/arithmetic.go:262 +0x1d
    github.com/go-python/gpython/vm.do_BINARY_MULTIPLY(0xc074930, 0x3, 0x0, 0x0)
        /home/ncw/go/src/github.com/go-python/gpython/vm/eval.go:248 +0xc
    github.com/go-python/gpython/vm.RunFrame(0xc0a4370, 0x0, 0xc07bd18, 0x0, 0x0)
        /home/ncw/go/src/github.com/go-python/gpython/vm/eval.go:1785 +0x3f
    github.com/go-python/gpython/vm.EvalCodeEx(0xc04c400, 0xc062db0, 0xc062db0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/ncw/go/src/github.com/go-python/gpython/vm/eval.go:2162 +0xa3
    github.com/go-python/gpython/vm.Run(0xc062db0, 0xc062db0, 0xc04c400, 0x0, 0x0, 0x0, 0x0, 0x1, 0x9d240, 0xc04c400)
        /home/ncw/go/src/github.com/go-python/gpython/vm/eval.go:2182 +0x2
    github.com/go-python/gpython/repl.(*REPL).Run(0xc09a6c0, 0xc04a660, 0x17)
        /home/ncw/go/src/github.com/go-python/gpython/repl/repl.go:99 +0x20
    main.main.func1(0xc01e450, 0x2, 0x2)
        /home/ncw/go/src/github.com/go-python/gpython/repl/web/main.go:82 +0x4
    syscall/js.callbackLoop()
        /opt/go/go1.11/src/syscall/js/callback.go:116 +0x7
    created by syscall/js.NewCallback.func1
        /opt/go/go1.11/src/syscall/js/callback.go:40 +0x2
    
    opened by xiaxinmeng 1
  • transforming generators into list trigger crashing

    transforming generators into list trigger crashing

    In the following example, we initialize a 'population' with a list then we define a generator 'gen'. When we transform the generator into list, it crashes gpython with message "panic: runtime error: makeslice: len out of range".

    test.py

    population = list(range(10))
    gen = (-1 * population for w in range(10))
    list(gen)
    

    Output on go/wasm(https://gpython.org/?wasm):

    Gpython 3.4.0 running in your browser with go/wasm
    >>> population = list(range(10))
    >>> gen = (-1 * population for w in range(10))
    >>> list(gen)
    panic: runtime error: makeslice: len out of range
    goroutine 5 [running]:
    github.com/go-python/gpython/py.NewListSized(...)
        /home/ncw/go/src/github.com/go-python/gpython/py/list.go:52
    github.com/go-python/gpython/py.(*List).M__mul__(0xc05ea40, 0x9d6e0, 0xc01e660, 0x3eca0, 0x59a80, 0xffffffffffffff01, 0x2c932218)
        /home/ncw/go/src/github.com/go-python/gpython/py/list.go:239 +0x13
    github.com/go-python/gpython/py.(*List).M__rmul__(0xc05ea40, 0x9d6e0, 0xc01e660, 0x2c932218, 0xc05ea40, 0x1, 0x0)
        /home/ncw/go/src/github.com/go-python/gpython/py/list.go:249 +0x2
    github.com/go-python/gpython/py.Mul(0x9d6e0, 0xc01e660, 0x9d340, 0xc05ea40, 0xc0de420, 0xc01e660, 0x0, 0x0)
        /home/ncw/go/src/github.com/go-python/gpython/py/arithmetic.go:274 +0x14
    github.com/go-python/gpython/vm.do_BINARY_MULTIPLY(0xc074a10, 0x0, 0x0, 0x0)
        /home/ncw/go/src/github.com/go-python/gpython/vm/eval.go:248 +0xc
    github.com/go-python/gpython/vm.RunFrame(0xc0de420, 0x4a408, 0x4a3f8, 0x10860032, 0x366168)
        /home/ncw/go/src/github.com/go-python/gpython/vm/eval.go:1785 +0x3f
    github.com/go-python/gpython/py.(*Generator).Send(0xc0632f0, 0x9d720, 0x3661e8, 0x3e720, 0x4a3c0, 0x1, 0x2c9321b8)
        /home/ncw/go/src/github.com/go-python/gpython/py/generator.go:100 +0xb
    github.com/go-python/gpython/py.(*Generator).M__next__(0xc0632f0, 0x9d300, 0xc0632f0, 0x2c9321b8, 0xc0632f0)
        /home/ncw/go/src/github.com/go-python/gpython/py/generator.go:71 +0x2
    

    output with gopherjs(https://gpython.org/):

    [USER]: https://gpython.org/gpython.js: runtime error: makeslice: len out of range
    $callDeferred@https://gpython.org/gpython.js:4:22511
    $panic@https://gpython.org/gpython.js:4:22957
    AK@https://gpython.org/gpython.js:10:2429
    $makeSlice@https://gpython.org/gpython.js:4:20053
    GF@https://gpython.org/gpython.js:41:276509
    GB.ptr.prototype.M__mul__@https://gpython.org/gpython.js:41:286563
    GB.ptr.prototype.M__rmul__@https://gpython.org/gpython.js:41:286854
    AG@https://gpython.org/gpython.js:41:47063
    W@https://gpython.org/gpython.js:44:19407
    DO@https://gpython.org/gpython.js:44:91592
    EJ.ptr.prototype.Send@https://gpython.org/gpython.js:41:212721
    EJ.ptr.prototype.M__next__@https://gpython.org/gpython.js:41:211418
    LD@https://gpython.org/gpython.js:41:316574
    LE@https://gpython.org/gpython.js:41:319732
    GB.ptr.prototype.ExtendSequence@https://gpython.org/gpython.js:41:277441
    LC@https://gpython.org/gpython.js:41:315768
    GC@https://gpython.org/gpython.js:41:276033
    MH.ptr.prototype.M__call__@https://gpython.org/gpython.js:41:366934
    FK@https://gpython.org/gpython.js:41:255589
    DN@https://gpython.org/gpython.js:44:82459
    EE.ptr.prototype.Call@https://gpython.org/gpython.js:44:87109
    DC@https://gpython.org/gpython.js:44:77098
    DO@https://gpython.org/gpython.js:44:91592
    DU@https://gpython.org/gpython.js:44:107450
    DW@https://gpython.org/gpython.js:44:109015
    G.ptr.prototype.Run@https://gpython.org/gpython.js:56:3575
    $b@https://gpython.org/gpython.js:60:3908
    $b@https://gpython.org/gpython.js:59:2625
    r@https://gpython.org/gpython.js:4:23443
    $runScheduled@https://gpython.org/gpython.js:4:24007
    $schedule@https://gpython.org/gpython.js:4:24184
    $go@https://gpython.org/gpython.js:4:23907
    I/$packages["github.com/gopherjs/gopherwasm/js"]<@https://gpython.org/gpython.js:59:2240
    $externalizeFunction/e.$externalizeWrapper@https://gpython.org/gpython.js:4:28925
    a@https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/1.23.2/js/jquery.terminal.min.js:40:82615
    k@https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/1.23.2/js/jquery.terminal.min.js:40:83463
    ENTER@https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/1.23.2/js/jquery.terminal.min.js:40:14915
    $e@https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/1.23.2/js/jquery.terminal.min.js:40:28362
    dispatch@https://code.jquery.com/jquery-latest.js:4641:9
    add/elemData.handle@https://code.jquery.com/jquery-latest.js:4309:28
    
    opened by xiaxinmeng 1
  • Defining Nested set crashes gpython

    Defining Nested set crashes gpython

    In gpython, if we define a nested set, it will lead to crashing. s = {('string', 1), ('string', 2), ('string', 3)}

    Output on go/wasm(https://gpython.org/?wasm):

    Gpython 3.4.0 running in your browser with go/wasm
    >>> s = {('string', 1), ('string', 2), ('string', 3)}
    panic: runtime error: hash of unhashable type py.Tuple
    goroutine 5 [running]:
    github.com/go-python/gpython/py.NewSetFromItems(0xc09a880, 0x3, 0x4, 0x2)
        /home/ncw/go/src/github.com/go-python/gpython/py/set.go:42 +0xc
    github.com/go-python/gpython/vm.do_BUILD_SET(0xc074770, 0x3, 0x0, 0x0)
        /home/ncw/go/src/github.com/go-python/gpython/vm/eval.go:996 +0x5
    github.com/go-python/gpython/vm.RunFrame(0xc0de0b0, 0x0, 0xc07bd18, 0x0, 0x0)
        /home/ncw/go/src/github.com/go-python/gpython/vm/eval.go:1785 +0x3f
    github.com/go-python/gpython/vm.EvalCodeEx(0xc04c200, 0xc062db0, 0xc062db0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/ncw/go/src/github.com/go-python/gpython/vm/eval.go:2162 +0xa3
    github.com/go-python/gpython/vm.Run(0xc062db0, 0xc062db0, 0xc04c200, 0x0, 0x0, 0x0, 0x0, 0x1, 0x9d240, 0xc04c200)
        /home/ncw/go/src/github.com/go-python/gpython/vm/eval.go:2182 +0x2
    github.com/go-python/gpython/repl.(*REPL).Run(0xc09a6c0, 0xc09c080, 0x31)
        /home/ncw/go/src/github.com/go-python/gpython/repl/repl.go:99 +0x20
    main.main.func1(0xc01e3f0, 0x2, 0x2)
        /home/ncw/go/src/github.com/go-python/gpython/repl/web/main.go:82 +0x4
    syscall/js.callbackLoop()
        /opt/go/go1.11/src/syscall/js/callback.go:116 +0x7
    created by syscall/js.NewCallback.func1
        /opt/go/go1.11/src/syscall/js/callback.go:40 +0x2
    

    output with gopherjs(https://gpython.org/):

    Gpython 3.4.0 running in your browser with gopherjs
    >>> s = {('string', 1), ('string', 2), ('string', 3)}
    [USER]: https://gpython.org/gpython.js: n.keyFor is not a function
    $ifaceKeyFor@https://gpython.org/gpython.js:4:9630
    LL@https://gpython.org/gpython.js:41:324569
    BY@https://gpython.org/gpython.js:44:56407
    DO@https://gpython.org/gpython.js:44:91592
    DU@https://gpython.org/gpython.js:44:107450
    DW@https://gpython.org/gpython.js:44:109015
    G.ptr.prototype.Run@https://gpython.org/gpython.js:56:3575
    $b@https://gpython.org/gpython.js:60:3908
    $b@https://gpython.org/gpython.js:59:2625
    r@https://gpython.org/gpython.js:4:23443
    $runScheduled@https://gpython.org/gpython.js:4:24007
    $schedule@https://gpython.org/gpython.js:4:24184
    $go@https://gpython.org/gpython.js:4:23907
    I/$packages["github.com/gopherjs/gopherwasm/js"]<@https://gpython.org/gpython.js:59:2240
    $externalizeFunction/e.$externalizeWrapper@https://gpython.org/gpython.js:4:28925
    a@https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/1.23.2/js/jquery.terminal.min.js:40:82615
    k@https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/1.23.2/js/jquery.terminal.min.js:40:83463
    ENTER@https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/1.23.2/js/jquery.terminal.min.js:40:14915
    $e@https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/1.23.2/js/jquery.terminal.min.js:40:28362
    dispatch@https://code.jquery.com/jquery-latest.js:4641:9
    add/elemData.handle@https://code.jquery.com/jquery-latest.js:4309:28
    
    bug 
    opened by xiaxinmeng 1
Releases(v0.1.0)
  • v0.1.0(Feb 15, 2022)

    This release ships with a new multi-context interpreter.

    Many thanks to @drew-512 for this work are in order.

    What's Changed

    • ci: use latest patch version of Go releases by @sbinet in https://github.com/go-python/gpython/pull/4
    • Go mod by @sbinet in https://github.com/go-python/gpython/pull/5
    • ci: add appveyor build (windows) by @sbinet in https://github.com/go-python/gpython/pull/7
    • all: apply gofmt simplify by @sbinet in https://github.com/go-python/gpython/pull/9
    • appveyor.yml: Fix gcc issue on go test -race ./... by @corona10 in https://github.com/go-python/gpython/pull/16
    • ci: add Go1.11, drop Go1.8 by @sbinet in https://github.com/go-python/gpython/pull/17
    • builtin: Update builtin_all and builtin_any for Python3 by @corona10 in https://github.com/go-python/gpython/pull/15
    • gpython: use peterh/[email protected] by @sbinet in https://github.com/go-python/gpython/pull/18
    • parser: Update from go tool yacc into goyacc by @corona10 in https://github.com/go-python/gpython/pull/22
    • builtin: Implement builtin sum by @corona10 in https://github.com/go-python/gpython/pull/21
    • Initial work at implementing file methods by @raff in https://github.com/go-python/gpython/pull/13
    • print should use str or repr when available by @raff in https://github.com/go-python/gpython/pull/26
    • Add support for print to file and file flush. by @raff in https://github.com/go-python/gpython/pull/27
    • Added str and repr plus missing properties by @raff in https://github.com/go-python/gpython/pull/31
    • py: Fix TracebackDump not to dump duplicated exception type by @corona10 in https://github.com/go-python/gpython/pull/36
    • parser: Update make_grammer_text.py by @corona10 in https://github.com/go-python/gpython/pull/37
    • py: Fix errors are suppressed in generator comprehensions by @corona10 in https://github.com/go-python/gpython/pull/38
    • py: Support len of rangetype. by @corona10 in https://github.com/go-python/gpython/pull/40
    • builtin: Implement enumerate feature by @corona10 in https://github.com/go-python/gpython/pull/43
    • py: Fix range to support negative step by @corona10 in https://github.com/go-python/gpython/pull/42
    • py: Support zip builtin feature by @corona10 in https://github.com/go-python/gpython/pull/45
    • py: Implement range M__getitem__ by @corona10 in https://github.com/go-python/gpython/pull/47
    • Implement benchmark framework for gpython along with a couple of benchmarks by @ncw in https://github.com/go-python/gpython/pull/51
    • builtin: Implement min/max builtin function by @corona10 in https://github.com/go-python/gpython/pull/48
    • builtin: Implement builtin_iter by @corona10 in https://github.com/go-python/gpython/pull/54
    • builtin: Implement delattr by @corona10 in https://github.com/go-python/gpython/pull/55
    • Fix initialisation of function, staticmethod and classmethod dict by @ncw in https://github.com/go-python/gpython/pull/57
    • #44 Display build information by @kislenko-artem in https://github.com/go-python/gpython/pull/52
    • Adding split method to string class by @kellrott in https://github.com/go-python/gpython/pull/60
    • Adding iterator method to Dict by @kellrott in https://github.com/go-python/gpython/pull/59
    • String and List Methods by @kellrott in https://github.com/go-python/gpython/pull/61
    • fix: ~/.gpyhistory: no such file or directory by @msAlcantara in https://github.com/go-python/gpython/pull/63
    • dict: Implement contains of dict by @corona10 in https://github.com/go-python/gpython/pull/65
    • py: Fix mul of list and tuple on negative case by @corona10 in https://github.com/go-python/gpython/pull/67
    • builtin: Implement builtin_ascii by @corona10 in https://github.com/go-python/gpython/pull/66
    • builtin: Implement builtin_bin by @corona10 in https://github.com/go-python/gpython/pull/70
    • Generate SyntaxError of global declaration by @HyeockJinKim in https://github.com/go-python/gpython/pull/74
    • Implement and of set by @DoDaek in https://github.com/go-python/gpython/pull/82
    • set: Implement or of set by @DoDaek in https://github.com/go-python/gpython/pull/84
    • Implement range object by @HyeockJinKim in https://github.com/go-python/gpython/pull/87
    • set: Implement sub and xor of set by @DoDaek in https://github.com/go-python/gpython/pull/88
    • Fix "end" option in print func by @Sungmin-Joo in https://github.com/go-python/gpython/pull/90
    • Add Slice function for range type by @HyeockJinKim in https://github.com/go-python/gpython/pull/83
    • Revert "Fix "end" option in print func" by @corona10 in https://github.com/go-python/gpython/pull/94
    • Fix comments in REPL - fixes #78 by @ncw in https://github.com/go-python/gpython/pull/79
    • set: Implement initialization set with sequence by @SanggiHong in https://github.com/go-python/gpython/pull/100
    • Add new function and property of slice by @HyeockJinKim in https://github.com/go-python/gpython/pull/99
    • Add sorted and list.sort in https://github.com/go-python/gpython/pull/81
    • Change repr(float) if float(int(f)) == f in https://github.com/go-python/gpython/pull/104
    • Handle the non-integer return of index by @HyeockJinKim in https://github.com/go-python/gpython/pull/97
    • ci: drop Go-1.9+1.10, add Go-1.12.x and Go-1.13.x by @sbinet in https://github.com/go-python/gpython/pull/113
    • Implement float is_integer method by @DoDaek in https://github.com/go-python/gpython/pull/112
    • Implementing the "get" function on a "Dictionary" by @Sungmin-Joo in https://github.com/go-python/gpython/pull/106
    • ne of dict return NotImplemented by @HyeockJinKim in https://github.com/go-python/gpython/pull/109
    • ne of set return NotImplemented by @HyeockJinKim in https://github.com/go-python/gpython/pull/110
    • Implement eq, ne for slice by @HyeockJinKim in https://github.com/go-python/gpython/pull/107
    • Implement set repr by @xarus01 in https://github.com/go-python/gpython/pull/117
    • Implement isinstance by @xarus01 in https://github.com/go-python/gpython/pull/122
    • Initial attempt at gometalinter rules by @sbinet in https://github.com/go-python/gpython/pull/125
    • ci: add go-import-path to handle fork builds by @sbinet in https://github.com/go-python/gpython/pull/127
    • Cleanup Go Module, remove spurious coverage file by @sbinet in https://github.com/go-python/gpython/pull/124
    • builtin,vm: add implementation for builtin hex function by @sbinet in https://github.com/go-python/gpython/pull/123
    • Fix bug in "items" function by @Sungmin-Joo in https://github.com/go-python/gpython/pull/115
    • all: add GitHub Actions CI by @sbinet in https://github.com/go-python/gpython/pull/147
    • ci: update CI scaffolding by @sbinet in https://github.com/go-python/gpython/pull/148
    • time: add time_ns function by @sbinet in https://github.com/go-python/gpython/pull/146
    • Ci no travis by @sbinet in https://github.com/go-python/gpython/pull/149
    • kwarg testing (exposes bugs in py.ParseTupleAndKeywords) by @drew-512 in https://github.com/go-python/gpython/pull/151
    • resolved benign Go warnings by @drew-512 in https://github.com/go-python/gpython/pull/153
    • better Int.abs() and test coverage by @drew-512 in https://github.com/go-python/gpython/pull/156
    • Add list type safety, helpers; remove cruft by @drew-512 in https://github.com/go-python/gpython/pull/157
    • Add multi context by @drew-512 in https://github.com/go-python/gpython/pull/158
    • gpython: blank-import gpython/modules by @sbinet in https://github.com/go-python/gpython/pull/162
    • added examples and py utils by @drew-512 in https://github.com/go-python/gpython/pull/159
    • examples/{embedding,multi-context}: add LICENSE blurb, cosmetics by @sbinet in https://github.com/go-python/gpython/pull/163
    • proper example completeness by @drew-512 in https://github.com/go-python/gpython/pull/164
    • updated README by @drew-512 in https://github.com/go-python/gpython/pull/160

    New Contributors

    • @sbinet made their first contribution in https://github.com/go-python/gpython/pull/4
    • @raff made their first contribution in https://github.com/go-python/gpython/pull/13
    • @ncw made their first contribution in https://github.com/go-python/gpython/pull/51
    • @kislenko-artem made their first contribution in https://github.com/go-python/gpython/pull/52
    • @kellrott made their first contribution in https://github.com/go-python/gpython/pull/60
    • @msAlcantara made their first contribution in https://github.com/go-python/gpython/pull/63
    • @HyeockJinKim made their first contribution in https://github.com/go-python/gpython/pull/74
    • @DoDaek made their first contribution in https://github.com/go-python/gpython/pull/82
    • @Sungmin-Joo made their first contribution in https://github.com/go-python/gpython/pull/90
    • @SanggiHong made their first contribution in https://github.com/go-python/gpython/pull/100
    • @xarus01 made their first contribution in https://github.com/go-python/gpython/pull/117
    • @drew-512 made their first contribution in https://github.com/go-python/gpython/pull/151

    Full Changelog: https://github.com/go-python/gpython/compare/v0.0.2...v0.1.0

    Source code(tar.gz)
    Source code(zip)
  • v0.0.3(Dec 5, 2018)

    Changelog

    f4ab05f Initial attempt at gometalinter rules f7ea0a4 Add a Community section to the README 734fbaa py: Fix errors are suppressed in generator comprehensions 0773b68 parser: Update make_grammer_text.py 2981ee9 py: Fix TracebackDump not to dump duplicated exception type b715616 repl/web: apply wasm_exec.js.patch to fix print() under wasm 50cd487 Implement a web based REPL using gpython 08903fc Factor REPL into CLI part and agnostic part and add tests d13383c vm: make PrintExpr hook for steering the output of PRINT_EXPR in the REPL d05bbcc complex: added str and repr plus missing properties 4f66e54 Add support for print to file and file flush. 8cee534 Make getattr return methods implemented in go - fixes #28 ee952c8 print should use str or repr when available 6e7b5ec Initial work at implementing file methods: - open (builtin) - File.read - File.write - File.close 09f14d0 builtin: Implement builtin sum (#21) eaa7d28 build: run py3test.py, installing python3.4 if necessary bf8d938 Revamp py3test a5185a2 bin: script to install python 3.4 f7ce7c0 math: tests: Rename math.py -> mathtests.py so "import math" works properly 6ded9bc parser: Update from go tool yacc into goyacc (#22) ed3c651 ci: enable GO111MODULE=on for master a182849 gpython: use peterh/[email protected] b55db0b builtin: Update builtin_all and builtin_any for Python3 c6c49d2 ci: add Go1.11, drop Go1.8 (#17) 60ae876 appveyor.yml: Fix gcc issue on go test -race ./... 6a2b593 all: apply gofmt simplify 16e9ec3 gpython: point to new home of grumpy dd41cdd gpython: add code coverage support e9df6dc ci: add appveyor build (windows) e9ee2ff gpython: add license badge 43a6207 gpython: add initial support for Go modules c37be76 ci: use latest patch version of Go releases


    Automated with GoReleaser Built with go version go1.11.2 linux/amd64

    Source code(tar.gz)
    Source code(zip)
    gpython_0.0.3_checksums.txt(1.31 KB)
    gpython_0.0.3_freebsd_386.zip(1.54 MB)
    gpython_0.0.3_freebsd_amd64.zip(1.62 MB)
    gpython_0.0.3_freebsd_armv6.zip(1.53 MB)
    gpython_0.0.3_linux_386.zip(1.54 MB)
    gpython_0.0.3_linux_amd64.zip(1.63 MB)
    gpython_0.0.3_linux_arm64.zip(1.49 MB)
    gpython_0.0.3_linux_armv6.zip(1.53 MB)
    gpython_0.0.3_macOS_386.zip(1.62 MB)
    gpython_0.0.3_macOS_amd64.zip(1.69 MB)
    gpython_0.0.3_netbsd_386.zip(1.53 MB)
    gpython_0.0.3_netbsd_amd64.zip(1.61 MB)
    gpython_0.0.3_netbsd_armv6.zip(1.52 MB)
    gpython_0.0.3_windows_386.zip(1.56 MB)
    gpython_0.0.3_windows_amd64.zip(1.65 MB)
  • v0.0.0(Aug 5, 2018)

    Changelog

    c0de7de travis: don't test on go1.7 as it fails the math tests 46f8028 math: comment out some expm1 tests which fail on 32 bit a910f3b travis: run tests in 32 bit mode as well 32e35ae math: fix compile on 32 bit systems 9e5c0d4 Change Type.Flags to uint to make gpython compile on 32 bit OSes f75f21e Tidy junk files 9442150 Add goreleaser to make packages on github 77dde64 Test gpython with Travis CI 8b45fd5 Fix link to PSF licence 7418ece Add LICENSE, README and examples 5e6dfca Note about clang tools 97e4a0f compile: add line numbers to compiler and create line number table (lnotab) bbab811 compile, symtable, parse: get lineno, offset, file into SyntaxErrors 4fc4f37 testparser: make it compile too and make a py3 comparison c8b83ac py, parse: float - fix parsing of out of range floats and floats with spaces bdc70db parser: testparser - script to parse all the python source 132a9f5 py: int - fix base conversion with base and sigil c61c054 Make tests past with python3 too b9545a4 py: type - fix initialisation and repr eb7e8f3 py: fix GoInt and GoInt64 for BigInts af1ba18 py: list fix add 066aaa7 math: implement math module 7e4f791 py: method - add eq and ne 40a2528 py: make == and != complain if comparing the same type with no eq method f148ad3 Notes on dict implementation 20fb671 builtin: implement exec() and eval() d0c72a9 vm: stop dict literals or dict comp panicing with non string keys f16c0ab py: int: fix multiply bf7e345 repl: allow """ strings to span lines e1bc5aa parser: return correct errors for unterminated triple quoted strings d9667bc repl: implement multi line code input with continuation lines e352670 parser: fix "single" mode and return correct EOF error 5775015 repl: line editing with history and completion 5148b8e py: repr and str for bool, bytes, dict, ellipsis, list, module, none, string, tuple 3f14f3d py, builtin, vm: make str() and repr() and implement some str and repr de8c04a builtin: make print end= and sep= work 1a6a2dd Remove debug print messages bf490cc builtins: slightly improve print() 833d4da py: string - slightly better implementation of % operator 440aa7c py3test.py to run the unit tests with python3 as a cross check d831b11 py: string: make getitem and contains work and unit tests d95eafb py: fix Eq and Ne 7bea4c3 Fix errors spotted by go vet 648fc13 parser: fix error on setting someting which can't be set, eg f()=1 927e70d parser: fix reporting of errors and parsing of decimals with leading zeros 60d12b3 parser: implement string escapes 6125042 py: int: Fix neg(IntMin) and round(IntMin) 0e6bb4c py: implement round() for int/long, float() and complex() 2bc7a53 builtin: implement divmod db8950c py: int: tests for *, <<, >> and fixes 313e2cb py: int: fix floor divide to be exactly the same as python 0dce941 py: Implement BigInt to extend Int and tests for it b6756c7 py: fix arithmetic operations code generator and code f863723 Make sys.args accurate and implement -cpuprofile flag 00ffff0 vm: keep locals local (5% speedup) cf0f887 vm: compile debug out with a constant - 180% speed improvement! 4b9bdd5 Change from panic/recover error handling to go style error values 9d45873 vm, builtin, py: locals(), globals() and builtin fixes 4f76837 vm,py: fix generators called after end of code 8e7ded6 py: Fix SetAttr 28b616d pytest: factor python testing framework into own module 71b65b7 py: import - make work better in REPL and look for init.py 4ccf870 repl: very basic REPL cae96e7 vm: implement CALL_FUNCTION, fast locals and make function calling work properly 7f90811 compile: fix kwonlyargs and raise SyntaxError on duplicated keywords e4ed532 py: exception: bodge to return Exception.args 3a20288 py: code: remove extra brackets db28072 py: dict: implement eq and ne b306413 symtable: fix functions with no normal arguments (only args etc) 6a2dcc9 vm: Implement SETUP_WITH and WITH_CLEANUP 1d7e528 compile: fix continue in with block e2cd6ef py: eq and ne for type 07d321a vm: tidy tests 7c07fd2 vm: tests for generators 447496c vm: give opcode its own type 0838829 vm: raise tests 30367ff vm: rename variables to be more like the python original code 87adad3 vm: fix continue 3d425a8 vm: fix exception handling 4865ebf py: ExceptionInfo - check for nil 5a57a8b compile: make SyntaxError on return outside function 19f32cb vm: Tests for STORE_ATTR, LOAD_ATTR, DELETE_ATTR d059504 vm: implement IMPORT_NAME, IMPORT_FROM, IMPORT_STAR; py: factor Attribute code a20d443 vm: implement in, not in; py: changed args to Iterate acaa5df vm: more tests for lists and DELETE_SUBSCR, UNPACK_EX, UNPACK_SEQUENCE etc bb6f44c py: implement DelItem 194e817 py: tuple - Reverse method 3a897b0 py: float and int - check for divide by zero 5a56e32 vm: tests for loops ceed469 vm: remove STORE_LOCALS opcode as it is no longer used 5546ccd py: failing test for IsSubtype 0d4a6d4 vm: tests and fixes for exceptions 5ceac9c compile: more tests on exception handling bf0f523 vm: class definitions 114c283 vm: functions & DELETE_NAME, DELETE_GLOBAL, LOAD_NAME, LOAD_GLOBAL, STORE_DEREF, DELETE_DEREF f570f95 vm: tests for comprehensinos, SET_ADD and MAP_ADD opcodes 7ac88d9 py: dict.setitem and dict.getitem 4a7ad17 py: temporary set.eq and set.ne 44242f0 Remove emacs noise and coverage from .gitignore 1305651 vm: start of test suite 0273331 py: fix <<= for int 9402ed8 compile: improve coverage and tidy code 08f7c83 compile: Fix continue and loops in general 3965a79 compile: implement subscript and fix attribute cd8c5fa compile: implement starred assignment e03f367 compile: use c.Exprs where appropriate 5602724 compile: implement Ellipsis 43c7838 py: implement eq and ne for Ellipsis 069f460 compile: implement yield and yield from cc7bc38 symtable: fix yield/yield from to set generator flag 6c151b7 compile: import/from import 8072a76 compile: implement try/except/finally 54e8dcb compile: with statement ebc723a compile: implement comprehensions 3c0ad78 compile: class definitions and module docstrings 8f4bd41 py: code: add eq and ne methods 99c3f74 compile: make decorators for functions work 7686a57 compile: finish lambdas including closures 5a2a35a compile: make closures compile properly 329523c symtable: add Find() method f0cbe48 compile: re-organise code cc59dde Fix uses of Compile e1d9f2c compile: implement return, docstrings, global 0acb046 compile: Fix Varnames c7d19e1 compile: remove disassembly from test data which makes it stable and shorter a0c3930 compile: make a simple function compile f7003ed symtable: remove unused import * checking code 7a5b132 symtable: correct package name and stop panic's escaping the package 21129d0 symtable: make definitions public 08446c2 symtable: fix functions, add classes, lambda, increase coverage efe2b0e ast: Walk - fix ExceptHandler traversal 88dcf55 symtable: fix tests after move 0f4c714 symtable: factor out from compile de6c5dd compile: symtable: implement list/set/dict/generator comprehensions 940b430 compile: symtable: test and fix flags 44e6f63 compile: symtable: global and nonlocal 5d621d0 compiler: fill out symtable machinery 39eaaff compiler: symtable - stringer and fix test f1c2c69 compiler: symbol table framework, plus test machinery 611c8dc ast: Walk - fix null pointer deref and increase test coverage 8eb8664 ast: implement Walk() function 3079681 compile: function definitions without body a39de11 tuple: implement eq and ne ff5d114 compiler: implement call 669e0e4 compile: implement for loop 50cdc44 compler: break, continue and framework for testing exceptions 1cfd200 compile: note that diffs are caused by bugs in python 3.4 6ab7061 lexer: fix whitespace issues 8d5c74e compile: Implement while and if ac9ca13 compiler: del and raise de8f9c5 compiler: assign and augmented assign 54f3149 compiler: pass, expr statement and assert 4826ccc compile: basic lambda: working d0ea27b compile: implement Dict, Set, attribute lookup 532fd9c compile: implement named constant (True, False, None) 6b7f42a py.Bool eq and ne 5f5112a py.None: eq and ne 54f7fe1 compiler: implement tuple and list 9b2aead compile: implement Bytes b881849 py.Bytes: implement comparisons b8b5f4e compiler: implement comparators 67b9193 compiler: Factor instructions into own file and rename some compile methods 363ce43 compile: Fixup panics to have name of thing they are panicing about 0a8e720 compiler: make stack depth calcuations work 853ec56 Fix 3.4 CLASSDEREF opcode definition 3842c62 compiler: Make names work and detect duplicate constants and names d7653f2 compile: Implement if expression and JUMP_FORWARD 6fa5265 compiler: Fix jump resolver 2ece17f compiler: Bool Ops, Labels, N pass assembly, Jump resolution d84b599 compiler: Unary Ops a9c21a1 compiler: basic infrastructure, constants and binops c49e757 Add test machinery for compile 6f1f9b2 Add auto generated y.go and y.output now the code is done (almost) bd6b992 Move grammar test data to its own file 1f41308 Improve coverage f8f4d5e Fix Ctx bf62f09 decorators 8ed83d0 Class definition 6ae1b00 Function definitions 0079df4 Lambda and varargs bad0904 Assign and augmented assign 8858589 With statememt 034315f try / except statememts 79b119d Fix assert statement a27bc28 Implement For and If b685896 Simple statements b3fe9bd Mark unfinished parts f627870 Make Call with arguments work 133ce36 trailers - call and subscript - call not finished 6305d51 Fix Call to have correct Func name f993dc7 Make nil items return as None 216cff9 BinOp, BoolOp and UnaryOp 058dc76 Fix Mod String 302a07f Get rid of uneccessary stacks and clear out yylval each lex 3078552 Generator, List, Set and Dictionary comprehensions 817f25d Add SetCtx and SetCtxer a08810b Ast dump Comprehension structs properly 69f12ff Implement tuple and list in ast - comprehensions still to go bdbd2d0 Fix parsing of Tuple within Set 13b545c Make simple set and dict literals work debd25b Empty dict 1950ac4 Parse numbers 8c9be74 Parse string literals into AST dc76883 Fix String dump 4ab8fc2 Dump Bytes 1d99034 More grammar f23426a Fix Identifier dumping eeaa6ed Add ellipsis 1455b43 Add str for None 3729af3 Implement True aa058f1 Dump py.Objects with str if possible adafadd Implement bool.str a1a397a Fix ast.Dump to output to be the same as Python dc4ddaa Make grammar tests 12ea25a Make testlist work 33659a5 Fix reduce/reduce conflict 571c05c More grammar to ast implementation 9efc2f4 More grammar to ast implementation 378d65e Fix exec mode - add \n on end if not present 41189eb Fix testparser after API changes 0adc14a Fix grammar for multiple entry points for compile mode c2c5db0 ast.Pos updates, and make initial parse work f76b12f Make parser return AST - some small parts working a112b80 Add []Ast to ast.Dump 5084eeb Python AST for gpython a1f34b2 Move to ast package 0bfa031 Make Go AST 77d414e Python.asdl and generator code straight from Python 3.4 4d6ae14 Tests for Lexer 1e62f18 Coverage of parseNumber and parseString 160b692 Fix ambiguity in try/except statement grammar 52f190f Fix ambiguity in FROM x IMPORT y 8dc6b03 Add backslash continuations and make lexer obey yyDebug so it isn't so noisy 4d27ead Implement implicit line joining * Redo indentation count code - better but still not 100% * Detect errors and return an error on Parse acd7411 Add debug-ability to yacc code 431305f Fix dictorsetmaker and testlist_comp 1da31d7 Fix argumentlist parsing 9ad6324 A test script for parsing and lexing ccfbbf6 go generate commands for building grammar 904ca07 Lexer for python 3.4 41a1540 Python 3.4 parser bcab40c Python Grammar file from Python 3.4 8e1e0b2 Update to use compiler from python3.4 a7d0488 Fix build_class so that it passes its locals properly 9524f0b Fix typo in comment f7c7648 Update marshal to v3 protocol from Python 3.4 85cf1cd Remove debugging c6c0fbd Implement ASCII only str.getitem e57a0df Implement chr() 338ca42 Implement COMPARE_OP IS and NOT_IS 3d702be Fix checking of object.new and init arguments 13dc258 Remove debug d58e96a Add compile time option for debug messages 49bcc8f Rudimentary string % operator b686bb2 Implement sys.exit and stdout/stderr/stdin 5f03d50 Basic file object 9a1bb3e Fix ParseTupleAndKeywords 9a3c5db Fix raising an exception in an except block b30f5fb Implement len() and py.Len bffb0f4 Implement int() 1e659f3 Skeleton sys module 0dedea3 Rich comparison for string 732ebed BUILD_SLICE, slice objects and slice indexing for lists and tuple implemented 287a1df Implement STORE_GLOBAL be4d292 Implement + and * for string, list and tuple 21d01bf Implement UNPACK_SEQUENCE e1f060c Set file when importing a module 7f0ea86 Implement parts of time module 63fe344 Implement ParseTuple and "d" option 47c8d26 Implement IMPORT_FROM e906ee1 Redo import e83891d Note on possible improvement a18babf Execute .py files directly 0b3a137 Implement compile() by cheating and calling python3.3 a74eee3 Implement getattr(), hasattr() and setattr() builtins 96bfd77 Remove importlib as too ambitious right now 45034ef Notes on gpython strings 1827c0c Fix Free and Cell variables to make closures work properly 103d54d Fix Code.Cell2Arg creation bb0b4cd Move iteration stuff into sequence.go 6bd194a Implement classmethod() and staticmethod() d625bd9 Implement bytes() constructor f72f347 Make iterate create the iterator itself 2cb6be9 Implement "s" type in ParseTupleAndKeywords fc906f0 Implement string len and bool 7d197e6 Implement list() factoring common parts out of tuple() into SequenceList, SequenceTuple and Iterate. d60fc6f Implement tuple.new 4eda964 Implement ord() 8cc57c1 Correct calling of init for new objects 13f5466 Make tracebacks work and show something useful cbcda57 Fix function exception message f9b0894 Implement py.DeleteAttr, py.NewStringDictSized and DELETE_ATTR, BUILD_MAP, STORE_MAP opcodes e387540 Notes on type caching 3aadc0b Attributes for Function object 150601a Implementation of properties 22b9afd Rework GetAttr and SetAttr and related parts 611ef13 Loading of frozen module importlib/bootstrap.py 0f6ac1b Make import statement, import builtin and IMPORT_NAME opcode work (a bit) 5511993 Better error reporting in sequence c1949ed Make modules have attributes and call methods in them 858b973 Implement "i" in ParseTupleAndKeywords c1a8582 Turn marshal into a proper module 3770178 Fix parameter order in checkNumberOfArgs 04017d1 Implement BUILD_SET for set literals eg {1,2,3} dd14ce9 Fill out Set interface - preliminary implementation only 5a8a876 Convert Set and FrozenSet into pointer types e1cecbb Implement LIST_APPEND for list comprehensions and speed up BUILD_TUPLE and BUILD_LIST f7bc949 Make List mutable - type is now *List ced6726 Fix go vet warnings 08eff15 Implement closures and LOAD_CLOSURE, LOAD_DEREF, MAKE_CLOSURE opcodes c85199b Raise internal errors properly using panic(ExceptionNewf(Exception, "msg")) ef89736 Implement generator send() and stub out throw() and close() e1f0bbd Make bound methods for built in types work properly 4dedb41 Implement builtin.next and py.IsException 84c03fa Implement YIELD_FROM and fix YIELD 9c120e6 Make generator protocol interface and adjust generator.go to use it 4a525b9 Make try/except/else/finally exception handling work ca73609 Update comments now have decided how exceptions get propagated 8234f5b Make ExceptionInfo which is Type, Value, Traceback for panic propagation 778850d Make sure exception subclasses have TPFLAGS_BASE_EXC_SUBCLASS set for ExceptionClassCheck 5aeba6f Work on exceptions * Improve internal interfaces for making and using exceptions * Catch and check exceptions in the vm * raise exceptions in the vm * Unwind blocks (more work to do) in the vm 6980c03 Notes on the differences between cpython and gpython 7c4b61a Make NewBool and use it to simplify code f18c29d Define exception heirachy 317101a Make a subclass of a type and implement Fast subclass flags e90b958 Notes on list implementation 4974b6d Notes on strings bc5ac4a Fix LOAD_NAME and remove incorrect workaround 03f02c0 Set name, doc and package in Module 0de7e76 Fix range object to step correctly ee4f980 Fix name lookup in Function object 89966c1 Implement getitem & setitem for List and getitem for Tuple 9e25827 Generators and YIELD_VALUE aa100dc Put the stack in the Frame like cpython in preparation for generators ac76658 Notes on attributes of built in objects 7619a72 Make py.Iter and make FOR_ITER use it b5c3273 Implement range() and object() 2a65fbd Sort out type Init and New so we can make built in objects too! 35eacd5 Implement STORE_ATTR / py.SetAttr 01e2121 Fix object init fc9465a Fix default arguments 40e3f41 Return bound methods on attribute access 9510b77 Implement LOAD_ATTR/py.GetAttr 058a4e2 Implement py.GetItem/BINARY_SUBSCR and optimise some vm stack operations 6fd60a4 Remove unneeded nil check in STORE_LOCALS now build_class is fixed 984bfd8 Fix locals for class constructor call daf467b Fix method calling for TypeCallX 17013ce Implement STORE_SUBSCR and SetItem and first attempt at attribute lookup 3fd76bb Dump the stack on exceptions in eval 9dc3e65 type() much more nearly working 9022860 Implement ParseTupleAndKeywords c8a6976 Make Tuple.Copy() 11d5c5d More implementation of types. Not fully working yet. edfec36 Start of Object operations 6cbdfef Sequence operations b2aa6e4 Fix problems noted by go vet 46bb245 Ignore test files 44ee1c2 Working towards making classes work c305f37 Implement py.None and NoneType 8ad766a Add missing STORE_LOCALS opcode and remove 3.4 LOAD_CLASSDEREF e85f707 Rework python function calling in preparation for polymorphism 60dd952 Make Iter() and Iterator type and implement GET_ITER, FOR_ITER, BUILD_LIST/TUPLE acc6057 Implement BREAK and CONTINUE opcodes c8a27c6 Implement blocks and make while loop work. Fix args > 255 also 36faf9f Implement remaining JUMP opcodes 64c73d3 If statements and rich comparisons e552306 Fix VM so calling functions works properly 3726302 Remove debug 2008d78 Fix CALL_FUNCTION opcode 7e4713c More builtins abs, round and pow plus more infrastructure 44e760e Implement Neg, Pos, Abs, Invert, MakeBool/Int/Float/Complex and Index 8131a31 Add remaining __ methods 110fc8a Implement divmod and pow and check and fix interfaces for int, float, complex c1b8923 More arithmetic operations c8d406d Fix complex type to complex128 6a21724 Auto generate boiler plate for arithmetic operations 55fd328 Implement add and subtract d30fc55 Factor types into own files and rename some 810fccf Fix VM to use stack frames and not to re-instantiate itself a217e4f Ignore all hello 21cd9f2 Cheap and nasty BINARY_ADD, fix LOAD_GLOBAL and vm.call() 51c26cc Implement STORE_FAST 3f7c1e2 Implement LOAD_GLOBAL 00d856f Fix integer unmarshal and add set & frozenset adbc338 Log error on function call for the moment 98bb655 Use more native types 6b8c802 Impelement LOAD_FAST 6e4d79a Name those opcodes af9a450 Work around circular import - now calls python functions 9a79b97 Notes on future plans b52ac85 Work on getting the python functions running dcccf9b Catch panics from vm 56baf07 Make builtin print sort of work 427419c Add module objects, method objects and a start at builtins 06dc53f Byte code loaded and partly executing 7a05a3c More work on basic types 1c83e6c Fix types and code object 507f2f9 Add illegal instruction as default 0827e7c More python types f65c2cd Tidy output 1f52454 Main gpython binary - slightly working 8ad5ca3 Read .pyc files 92e6a2d Add comparison opcodes 993788c Remove unused opcodes 4c48b1f First commit - work in progress only


    Automated with GoReleaser Built with go version go1.10.1 linux/amd64

    Source code(tar.gz)
    Source code(zip)
    gpython_0.0.0_checksums.txt(1.31 KB)
    gpython_0.0.0_freebsd_386.zip(1.13 MB)
    gpython_0.0.0_freebsd_amd64.zip(1.19 MB)
    gpython_0.0.0_freebsd_armv6.zip(1.15 MB)
    gpython_0.0.0_linux_386.zip(1.14 MB)
    gpython_0.0.0_linux_amd64.zip(1.21 MB)
    gpython_0.0.0_linux_arm64.zip(1.12 MB)
    gpython_0.0.0_linux_armv6.zip(1.15 MB)
    gpython_0.0.0_macOS_386.zip(1.20 MB)
    gpython_0.0.0_macOS_amd64.zip(1.25 MB)
    gpython_0.0.0_netbsd_386.zip(1.13 MB)
    gpython_0.0.0_netbsd_amd64.zip(1.19 MB)
    gpython_0.0.0_netbsd_armv6.zip(1.15 MB)
    gpython_0.0.0_windows_386.zip(1.15 MB)
    gpython_0.0.0_windows_amd64.zip(1.21 MB)
Owner
go-python
Bridges between Go and Python
go-python
Scriptable interpreter written in golang

Anko Anko is a scriptable interpreter written in Go. (Picture licensed under CC BY-SA 3.0, photo by Ocdp) Usage Example - Embedded package main impor

mattn 1.3k Dec 23, 2022
Grumpy is a Python to Go source code transcompiler and runtime.

Grumpy: Go running Python Overview Grumpy is a Python to Go source code transcompiler and runtime that is intended to be a near drop-in replacement fo

Google 10.6k Jan 7, 2023
Go -> Haxe -> JS Java C# C++ C Python Lua

go2hx Compile: Go -> Haxe -> Js, Lua, C#, C++, Java, C, Python warning: heavily experimental still a ways to go before an alpha. Come give feedback on

go2hx 78 Dec 14, 2022
A JavaScript interpreter in Go (golang)

otto -- import "github.com/robertkrimen/otto" Package otto is a JavaScript parser and interpreter written natively in Go. http://godoc.org/github.com/

Robert Krimen 7.1k Jan 2, 2023
wagon, a WebAssembly-based Go interpreter, for Go.

wagon wagon is a WebAssembly-based interpreter in Go, for Go. As of 2020/05/11 Wagon is in read-only mode, and looking for a maintainer. You may want

Go Interpreter 899 Dec 6, 2022
Yaegi is Another Elegant Go Interpreter

Yaegi is Another Elegant Go Interpreter. It powers executable Go scripts and plugins, in embedded interpreters or interactive shells, on top of the Go

Traefik Labs 5.1k Jan 5, 2023
Lisp Interpreter

golisp Lisp Interpreter Usage $ golisp < foo.lisp Installation $ go get github.com/mattn/golisp/cmd/golisp Features Call Go functions. Print random in

mattn 123 Dec 15, 2022
A simple interpreter

类型: 基础类型: 整形,浮点,字符串,布尔,空值(nil) 符合类型: 数组,只读数组(元组),字典 支持语句: if, elif, else, for, foreach, break, continue, return 支持类型定义: class, func 语法格式: 赋值语句---> ```

null 19 Aug 10, 2022
A Lua 5.3 VM and compiler written in Go.

DCLua - Go Lua Compiler and VM: This is a Lua 5.3 VM and compiler written in Go. This is intended to allow easy embedding into Go programs, with minim

Milo Christiansen 899 Dec 12, 2022
PHP parser written in Go

PHP Parser written in Go This project uses goyacc and ragel tools to create PHP parser. It parses source code into AST. It can be used to write static

Vadym Slizov 899 Dec 25, 2022
High-performance PHP application server, load-balancer and process manager written in Golang

RoadRunner is an open-source (MIT licensed) high-performance PHP application server, load balancer, and process manager. It supports running as a serv

Spiral Scout 6.9k Dec 30, 2022
An interpreted languages written in Go

Monkey My changes 1. Installation Source Installation go <= 1.11 Source installation go >= 1.12 Binary Releases 1.1 Usage 2 Syntax 2.1 Definitions 2.2

Steve Kemp 193 Jan 8, 2023
A compiler for the ReCT programming language written in Golang

ReCT-Go-Compiler A compiler for the ReCT programming language written in Golang

null 6 Nov 30, 2022
Interpreter - The Official Interpreter for the Infant Lang written in Go

Infant Lang Interpreter Infant Lang Minimalistic Less Esoteric Programming Langu

Infant Lang 2 Jan 10, 2022
Scriptable interpreter written in golang

Anko Anko is a scriptable interpreter written in Go. (Picture licensed under CC BY-SA 3.0, photo by Ocdp) Usage Example - Embedded package main impor

mattn 1.3k Jan 1, 2023
Scriptable interpreter written in golang

Anko Anko is a scriptable interpreter written in Go. (Picture licensed under CC BY-SA 3.0, photo by Ocdp) Usage Example - Embedded package main impor

mattn 1.3k Dec 23, 2022
A POSIX-compliant AWK interpreter written in Go

GoAWK: an AWK interpreter written in Go AWK is a fascinating text-processing language, and somehow after reading the delightfully-terse The AWK Progra

Ben Hoyt 1.6k Dec 31, 2022
A BASIC interpreter written in golang.

05 PRINT "Index" 10 PRINT "GOBASIC!" 20 PRINT "Limitations" Arrays Line Numbers IF Statement DATA / READ Statements Builtin Functions Types 30 PRINT "

Steve Kemp 289 Dec 24, 2022
A simple virtual machine - compiler & interpreter - written in golang

go.vm Installation Build without Go Modules (Go before 1.11) Build with Go Modules (Go 1.11 or higher) Usage Opcodes Notes The compiler The interprete

Steve Kemp 262 Dec 17, 2022
Mini lisp interpreter written in Go.

Mini Go Lisp Mini lisp interpreter written in Go. It is implemented with reference to the d-tsuji/SDLisp repository written in Java. Support System Fu

Tsuji Daishiro 17 Nov 25, 2022