Code Monkey home page Code Monkey logo

python-as3's Introduction

⚡ Pulse

Build status GitHub tag GitHub license Say Thanks!

Why?

I needed to run some code from a Flash-based game decompiled by amazing JPEXS Flash Decompiler.

Disclaimer

The implementation may not strictly follow the ActionScript specification.

Though, you're welcome to make a pull request to improve it. Please, try to follow the code style, run isort and add unit tests where applicable.

Development

  • Pipfile is here to set up a development environment quickly.
  • Use isort to sort imports.
  • Run tests with pytest.

Recipes

Interactive shell

The package contains an interactive shell to play around with the interpreter:

$ as3 --shell
Welcome to as3 shell!
Try: class X { function X() { this.a = 42 } function baz() { return this.a; } }; a = X().baz()
>>> class X { function X() { this.a = 42 } function bar() { return this.a } }
>>> x = X()
>>> trace(x)
<X object at 0x10bbdad68>
>>> trace(x.bar())
42

Running a script

from as3 import execute_script

execute_script('''
    function bar() {
        return 42
    }

    trace(bar());
''', '<ast>')

Magic functions

$ as3 --shell
Welcome to as3 shell!
Try: baz()
>>> trace(__globals__().keys())
dict_keys(['__dir__', '__globals__', '__resolve__', 'int', 'Math', 'String', 'trace', 'undefined', 'ASAny', 'ASObject', '__builtins__'])

python-as3's People

Contributors

eigenein avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.