Paul Sokolovsky
ac2e28c654
Support passing positional args as keywords to bytecode functions.
...
For this, record argument names along with each bytecode function. The code
still includes extensive debug logging support so far.
2014-02-16 18:36:33 +02:00
Damien George
8725f8f7de
py: Pass all scope flags through to runtime.
2014-02-15 19:33:11 +00:00
Paul Sokolovsky
520e2f58a5
Replace global "static" -> "STATIC", to allow "analysis builds". Part 2.
2014-02-12 18:31:30 +02:00
Damien George
9aa2a527b5
py: Tidy up BINARY_OPs; negation done by special NOT bytecode.
...
IS_NOT and NOT_IN are now compiled to IS + NOT and IN + NOT, with a new
special NOT bytecode.
2014-02-01 23:04:09 +00:00
Damien George
cbddb279bb
py: Implement break/continue from an exception with finally.
...
Still todo: break/continue from within the finally block itself.
2014-02-01 20:08:18 +00:00
Damien George
fb083ea986
py: mp_execute_byte_code has 2 arg arrays, for more efficient default params.
2014-02-01 18:29:40 +00:00
Paul Sokolovsky
90750029df
Implement default function arguments (for Python functions).
...
TODO: Decide if we really need separate bytecode for creating functions
with default arguments - we would need same for closures, then there're
keywords arguments too. Having all combinations is a small exponential
explosion, likely we need just 2 cases - simplest (no defaults, no kw),
and full - defaults & kw.
2014-02-01 15:38:22 +02:00
Damien George
62ad189a65
py: Add compile option to enable/disable source line numbers.
2014-01-29 21:51:51 +00:00
Damien George
08d075592f
py: Fix bug with LOAD_METHOD; fix int->machine_int_t for small int.
...
LOAD_METHOD bug was: emitbc did not correctly calculate the amount of
stack usage for a LOAD_METHOD operation.
small int bug was: int was being used to pass small ints, when it should
have been machine_int_t.
2014-01-29 18:58:52 +00:00
Damien George
28eb57786d
py: Optimise generated code for working out line numbers.
2014-01-25 11:43:20 +00:00
Damien George
41d02b654e
py: Improve freeing of emitters in mp_compile.
...
There can be multiple emitters allocated during compile (eg byte code
and native).
2014-01-24 22:42:28 +00:00
Paul Sokolovsky
f46d87a30d
Add support for freeing code emitter objects at the end of compilation.
2014-01-24 16:31:20 +02:00
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
2014-01-21 21:40:13 +00:00
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.
2014-01-19 11:48:48 +00:00
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.
2014-01-18 23:24:36 +00:00
Damien George
8d4ccc49ed
Merge branch 'master' of github.com:dpgeorge/micropython
2014-01-11 09:37:41 +00:00
Damien George
25042b19d2
py: Make arg to MP_BC_RAISE_VARARGS a byte.
2014-01-11 09:33:39 +00:00
John R. Lenton
b8698fca75
unified the bops
2014-01-11 00:58:59 +00:00
Damien George
e9906ac3d7
Add ellipsis object.
2014-01-04 18:44:46 +00:00
Damien George
1fb031744f
Change mp_compile so that it returns a function object for the module.
2014-01-03 14:22:03 +00:00
Damien George
6baf76e28b
py: make closures work.
2013-12-30 22:32:17 +00:00
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).
2013-12-21 18:17:45 +00:00
Damien
a1b2693161
py: remove further unnecessary emit_verbatim code.
2013-12-12 15:34:40 +00:00
Damien
9ecbcfff99
py: work towards working closures.
2013-12-11 00:41:43 +00:00
Damien
03c9cfb015
Make byte code jumps relative.
2013-11-05 22:06:08 +00:00
Damien
6addc89e55
Byte code for SMALL_INT uses 3 bytes for integer.
2013-11-04 23:04:50 +00:00
Damien
27fb45eb1c
Add local_num skeleton framework to deref/closure emit calls.
2013-10-20 15:07:49 +01:00
Damien
7bbd110691
Remove line in emitbc.c to print code size.
2013-10-18 19:57:17 +01:00
Damien
bd25445a82
Implement BC & runtime support for generator/yielding.
2013-10-16 20:39:12 +01:00
Damien
c025ebb2dc
Separate out mpy core and unix version.
2013-10-12 14:30:21 +01:00
Damien
eb19efb27e
Simplify and improve function & method calling.
2013-10-10 22:06:54 +01:00
Damien
7f5dacf345
Implement basic class/object in native code.
2013-10-10 11:24:39 +01:00
Damien
a397776d6b
Implement basic class/object functionality in runtime.
2013-10-09 23:10:10 +01:00
Damien
826005c60b
Add support for inline thumb assembly.
2013-10-05 23:17:28 +01:00
Damien
6cdd3af601
Implement built-in decorators to select emit type.
2013-10-05 18:08:26 +01:00
Damien
4b03e77d4a
Factorise EMIT_COMMON calls, mostly into emit_pass1.
2013-10-05 14:17:09 +01:00
Damien
054848a1b8
Compiler computes labels and max_num_labels.
2013-10-05 13:44:41 +01:00
Damien
b05d707b23
Further factorise PASS_1 out of specific emit code.
2013-10-05 13:37:10 +01:00
Damien
415eb6f850
Restructure emit so it goes through a method table.
2013-10-05 12:19:06 +01:00
Damien
429d71943d
Initial commit.
2013-10-04 19:53:11 +01:00