Damien George
600ae734cf
py: Implement break and continue byte codes, and add tests.
Also fixes a bug in the for-in-range optimiser.
I hope to remove break and continue byte codes in the future and just
use jump (if possible).
11 years ago
Damien George
55baff4c9b
Revamp qstrs: they now include length and hash.
Can now have null bytes in strings. Can define ROM qstrs per port using
qstrdefsport.h
11 years ago
Damien George
136b149e41
py: Add full traceback to exception printing.
11 years ago
Damien George
cbd2f7482c
py: Add module/function/class name to exceptions.
Exceptions know source file, line and block name.
Also tidy up some debug printing functions and provide a global
flag to enable/disable them.
11 years ago
Damien George
e02b2d4391
py: Temporary fix for bug where not enough VM state is allocated.
11 years ago
Damien George
932bf1c48f
py: Fix VM/runtime unpack sequence bug, Issue #193 .
11 years ago
Damien George
08335004cf
Add source file name and line number to error messages.
Byte code has a map from byte-code offset to source-code line number,
used to give better error messages.
11 years ago
Damien George
20006dbba9
Make VM stack grow upwards, and so no reversed args arrays.
Change state layout in VM so the stack starts at state[0] and grows
upwards. Locals are at the top end of the state and number downwards.
This cleans up a lot of the interface connecting the VM to C: now all
functions that take an array of Micro Python objects are in order (ie no
longer in reverse).
Also clean up C API with keyword arguments (call_n and call_n_kw
replaced with single call method that takes keyword arguments). And now
make_new takes keyword arguments.
emitnative.c has not yet been changed to comply with the new order of
stack layout.
11 years ago
Paul Sokolovsky
a9f5abd48c
Implement LOAD_CONST_INT (by dispatching to int object implementation).
11 years ago
John R. Lenton
5c76839559
sorted
11 years ago
Damien George
25042b19d2
py: Make arg to MP_BC_RAISE_VARARGS a byte.
11 years ago
John R. Lenton
b8698fca75
unified the bops
11 years ago
Paul Sokolovsky
5388a3c29a
Crude attempt to implement RAISE_VARARGS (with args=1 so far only).
11 years ago
Paul Sokolovsky
af61a1a492
Use constructor to create small int (avoid exposing mp_obj_t internals to VM).
11 years ago
ian-v
5fd8fd2c16
Revert MP_BOOL, etc. and use <stdbool.h> instead
11 years ago
ian-v
7a16fadbf8
Co-exist with C++ (issue #85 )
11 years ago
Paul Sokolovsky
e5ee1693ad
Use constructor to create small int (avoid exposing mp_obj_t internals to VM).
11 years ago
Damien George
e9906ac3d7
Add ellipsis object.
11 years ago
Paul Sokolovsky
e606cb6561
slice: Allow building with MICROPY_ENABLE_SLICE=0.
11 years ago
Paul Sokolovsky
ded0a1efa5
Implement BUILD_SLICE opcode (2-arg version).
11 years ago
Damien George
66327006fc
py: change negative array indices with array - 1.
11 years ago
Paul Sokolovsky
bdf822b3d8
Add quick impl for MP_BC_LOAD_CONST_BYTES which just creates qstr so far.
This is based on the fact that qstr so far behaves more like byte string
than like Unicode string (for example, "012"[0] returns 48 (int)).
11 years ago
Damien George
6baf76e28b
py: make closures work.
11 years ago
Damien
02a7c41e76
py: implement POP_BLOCK in VM.
11 years ago
Damien
b86e3f9293
py: implement some basic exception matching.
11 years ago
Damien
8f9e2ee157
Add code in VM to handle nested exceptions correctly.
11 years ago
Damien
d99b05282d
Change object representation from 1 big union to individual structs.
A big change. Micro Python objects are allocated as individual structs
with the first element being a pointer to the type information (which
is itself an object). This scheme follows CPython. Much more flexible,
not necessarily slower, uses same heap memory, and can allocate objects
statically.
Also change name prefix, from py_ to mp_ (mp for Micro Python).
11 years ago
Damien
660365e14c
py: split runtime into map, obj, builtin.
11 years ago
Damien
9ecbcfff99
py: work towards working closures.
11 years ago
Damien
db4c361f1c
py: add skeletal import functionality.
11 years ago
Damien
6f3e7fc505
py: add UNPACK_SEQUENCE and keyword methods to VM.
11 years ago
Damien
94658e2e25
Add JUMP_IF_x_OR_POP opcodes to VM.
11 years ago
Damien
40fdfe3000
Improve allocation of stack for byte code.
11 years ago
Damien
03c9cfb015
Make byte code jumps relative.
11 years ago
Damien
6addc89e55
Byte code for SMALL_INT uses 3 bytes for integer.
11 years ago
Damien
7410e440ab
Add basic complex number support.
11 years ago
Damien
4ebb32fb95
Implement: str.join, more float support, ROT_TWO in VM.
11 years ago
Damien
c12aa468a1
Add SET_ADD opcode to VM.
11 years ago
Damien
5fd09668b7
Add MAP_ADD opcode to VM.
11 years ago
Damien
bd25445a82
Implement BC & runtime support for generator/yielding.
11 years ago
Damien
c226dca1f7
Support tuples and list comprehension, albeit crude.
11 years ago
Damien
c9f91976e1
Crude try-except working.
11 years ago
Damien
ce89a21ea4
Implement basic exception framework, and simple for loop.
11 years ago
Damien
c025ebb2dc
Separate out mpy core and unix version.
11 years ago
Damien
eb19efb27e
Simplify and improve function & method calling.
11 years ago
Damien
a397776d6b
Implement basic class/object functionality in runtime.
11 years ago
Damien
b05d707b23
Further factorise PASS_1 out of specific emit code.
11 years ago
Damien
429d71943d
Initial commit.
11 years ago