<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/py/parse.c, branch v1.0.1</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=v1.0.1</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=v1.0.1'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2014-05-10T16:36:41+00:00</updated>
<entry>
<title>py: Improve handling of memory error in parser.</title>
<updated>2014-05-10T16:36:41+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2014-05-10T16:36:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=1b82e9af5c9b67cae8f7a35abc2dee3989fbdc06'/>
<id>urn:sha1:1b82e9af5c9b67cae8f7a35abc2dee3989fbdc06</id>
<content type='text'>
Parser shouldn't raise exceptions, so needs to check when memory
allocation fails.  This patch does that for the initial set up of the
parser state.

Also, we now put the parser object on the stack.  It's small enough to
go there instead of on the heap.

This partially addresses issue #558.
</content>
</entry>
<entry>
<title>py, parser: Add commented-out code to discard doc strings.</title>
<updated>2014-05-06T20:44:11+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2014-05-06T20:44:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=93afa230a42592023ba39951a48109d098f03bbe'/>
<id>urn:sha1:93afa230a42592023ba39951a48109d098f03bbe</id>
<content type='text'>
Doesn't help with RAM reduction because doc strings are interned as soon
as they are encountered, which is too soon to do any optimisations on
them.
</content>
</entry>
<entry>
<title>py: Turn down amount of RAM parser and compiler use.</title>
<updated>2014-05-05T12:19:03+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2014-05-05T12:19:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=66e18f04d811197854c0ce970b2dc8ac17deaebc'/>
<id>urn:sha1:66e18f04d811197854c0ce970b2dc8ac17deaebc</id>
<content type='text'>
There are 2 locations in parser, and 1 in compiler, where memory
allocation is not precise.  In the parser it's the rule stack and result
stack, in the compiler it's the array for the identifiers in the current
scope.  All other mallocs are exact (ie they don't allocate more than is
needed).

This patch adds tuning options (MP_ALLOC_*) to mpconfig.h for these 3
inexact allocations.

The inexact allocations in the parser should actually be close to
logarithmic: you need an exponentially larger script (absent pathological
cases) to use up more room on the rule and result stacks.  As such, the
default allocation policy for these is now to start with a modest sized
stack, but grow only in small increments.

For the identifier arrays in the compiler, these now start out quite
small (4 entries, since most functions don't have that many ids), and
grow incrementally by 6 (since if you have more ids than 4, you probably
have quite a few more, but it wouldn't be exponentially more).

Partially addresses issue #560.
</content>
</entry>
<entry>
<title>Add license header to (almost) all files.</title>
<updated>2014-05-03T22:27:38+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2014-05-03T22:27:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=04b9147e150d2d6fa3750f312fe328b6a71c1b28'/>
<id>urn:sha1:04b9147e150d2d6fa3750f312fe328b6a71c1b28</id>
<content type='text'>
Blanket wide to all .c and .h files.  Some files originating from ST are
difficult to deal with (license wise) so it was left out of those.

Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
</content>
</entry>
<entry>
<title>py: Check explicitly for memory allocation failure in parser.</title>
<updated>2014-04-10T14:27:31+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2014-04-10T14:27:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=58ba4c3b4c12e9bf6b8731fd26e0c9cac527122f'/>
<id>urn:sha1:58ba4c3b4c12e9bf6b8731fd26e0c9cac527122f</id>
<content type='text'>
Previously, a failed malloc/realloc would throw an exception, which was
not caught.  I think it's better to keep the parser free from NLR
(exception throwing), hence this patch.
</content>
</entry>
<entry>
<title>py: Clean up includes.</title>
<updated>2014-03-17T09:43:40+00:00</updated>
<author>
<name>xbe</name>
<email>xbe@machine</email>
</author>
<published>2014-03-16T07:14:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=efe34223945a5d27a7ae9445d0793d6330cd2411'/>
<id>urn:sha1:efe34223945a5d27a7ae9445d0793d6330cd2411</id>
<content type='text'>
Remove unnecessary includes. Add includes that improve portability.
</content>
</entry>
<entry>
<title>py: Implement bit-shift and not operations for mpz.</title>
<updated>2014-03-01T19:50:50+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2014-03-01T19:50:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=06201ff3d6d9485b2657fc9ac4aa8a306884322f'/>
<id>urn:sha1:06201ff3d6d9485b2657fc9ac4aa8a306884322f</id>
<content type='text'>
Implement not, shl and shr in mpz library.  Add function to create mpzs
on the stack, used for memory efficiency when rhs is a small int.
Factor out code to parse base-prefix of number into a dedicated function.
</content>
</entry>
<entry>
<title>parse: Refactor parse node encoding to support full range of small ints.</title>
<updated>2014-02-22T14:39:45+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2014-02-22T14:39:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=56e5ef203b01ac8dfb1cb46143f6f7c53237b79d'/>
<id>urn:sha1:56e5ef203b01ac8dfb1cb46143f6f7c53237b79d</id>
<content type='text'>
Based on suggestion by @dpgeorge at
https://github.com/micropython/micropython/pull/313
</content>
</entry>
<entry>
<title>parse: Note that fact that parser's small ints are different than VM small int.</title>
<updated>2014-02-21T01:27:09+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2014-02-21T00:04:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=bbf0e2fe120f095ce09fcb7eb631c9fd04bd9760'/>
<id>urn:sha1:bbf0e2fe120f095ce09fcb7eb631c9fd04bd9760</id>
<content type='text'>
Specifically, VM's small ints are 31 bit, while parser's only 28. There's already
MP_OBJ_FITS_SMALL_INT(), so, for clarity, rename MP_FIT_SMALL_INT() to
MP_PARSE_FITS_SMALL_INT().
</content>
</entry>
<entry>
<title>Implement proper exception type hierarchy.</title>
<updated>2014-02-15T16:10:44+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2014-02-15T16:10:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=c5966128c7c8a768f6726f299d85d5daef6bed48'/>
<id>urn:sha1:c5966128c7c8a768f6726f299d85d5daef6bed48</id>
<content type='text'>
Each built-in exception is now a type, with base type BaseException.
C exceptions are created by passing a pointer to the exception type to
make an instance of.  When raising an exception from the VM, an
instance is created automatically if an exception type is raised (as
opposed to an exception instance).

Exception matching (RT_BINARY_OP_EXCEPTION_MATCH) is now proper.

Handling of parse error changed to match new exceptions.

mp_const_type renamed to mp_type_type for consistency.
</content>
</entry>
</feed>
