Skip to content

gbour/Reblok

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reblok

Reblok build an Abstract Syntax Tree (AST) back from python bytecode.

###Requirements:

###Compatility:

  • python 2.[5-6] (NOT python 2.7, see Notes bellow)

  • Has not been tested with python3,

  • Should work with pypy, although some specific opcodes are not handled (see Pypy special opcodes).

###Installation easy_install reblok

or

wget http://devedge.bour.cc/resources/reblok/src/reblok.latest.tar.gz
tar xvf reblok.latest.tar.gz
cd reblok-* && ./setup.py install

Documentation

You can found reblok opcodes documentation at http://devedge.bour.cc/resources/reblok/doc/sources/ast.html

Example

>>> from reblok import Parser
>>> add = lambda x: x + 1
>>> ast = Parser().walk(add)
>>> print ast
['function', '<lambda>', [['ret', ('add', ('var', 'x', 'local'), ('const', 1))]], [('x', '<undef>')], None, None, [], {}]

Notes

reblok is not compatible with python 2.7 at the moment as JUMP_IF_FALSE and JUMP_IF_TRUE opcodes are replaced by new POP_JUMP_IF_FALSE, POP_JUMP_IF_TRUE, JUMP_IF_FALSE_OR_POP and JUMP_IF_TRUE_OR_POP opcodes.
Will be fixed in a future release.

Not yet handled opcodes:

  • POP_JUMP_IF_TRUE (py2.7)
  • POP_JUMP_IF_FALSE (py2.7)
  • JUMP_IF_FALSE_OR_POP (py2.7)
  • JUMP_IF_FALSE_OR_TRUE (py2.7)

About

Reblok is licensed under GNU GPL v3.
It is developped by Guillaume Bour <guillaume@bour.cc>

About

Reblok build an Abstract Syntax Tree (AST) back from python bytecode

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published