Improve the scope management in bytecode generator

Inspired by the changes made in Nyanga by Richard Hundt.

The upvalue closing code was moved to the generator instead of the op_retx
instruction to improve code logic.
Move code to register variables as upvalue in generator module

Avoid mixing instruction generation with variable classification as
upvalues.
Rename proto method close_block_uvals to close_block
Add command line options for to run the bytecode compiler.

The option "-b" is implemented to optionally print bytecode dump.
Add python script to perform automatic tests

The script execute each test using the bytecode compiler and compare the
output with the result obtained using LuaJIT2 directly.
Fix a couple of tests and add a test with a sorting algorithm