<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/py/parse.c, branch v1.5.1</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=v1.5.1</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=v1.5.1'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2015-11-17T14:00:14+00:00</updated>
<entry>
<title>py: Implement default and star args for lambdas.</title>
<updated>2015-11-17T14:00:14+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-11-17T14:00:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=2c838942574a4970c922d1550f04e4b7b4d865a6'/>
<id>urn:sha1:2c838942574a4970c922d1550f04e4b7b4d865a6</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py/parse: Make parser error handling cleaner, less spaghetti-like.</title>
<updated>2015-10-12T11:59:18+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-10-12T11:59:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=fdfcee7b1e321637767aaddfb781f66d0ffdc9a5'/>
<id>urn:sha1:fdfcee7b1e321637767aaddfb781f66d0ffdc9a5</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py: Move constant folding from compiler to parser.</title>
<updated>2015-10-12T11:58:45+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-10-08T13:58:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=64f2b213bb5be33f06ee7ab755d9344cd7e5958c'/>
<id>urn:sha1:64f2b213bb5be33f06ee7ab755d9344cd7e5958c</id>
<content type='text'>
It makes much more sense to do constant folding in the parser while the
parse tree is being built.  This eliminates the need to create parse
nodes that will just be folded away.  The code is slightly simpler and a
bit smaller as well.

Constant folding now has a configuration option,
MICROPY_COMP_CONST_FOLDING, which is enabled by default.
</content>
</entry>
<entry>
<title>py/parse: Factor logic when creating parse node from and-rule.</title>
<updated>2015-10-08T22:13:18+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-10-08T22:13:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=366239b8b9a2fbea3b6eae8dfc7b4a503d427e4c'/>
<id>urn:sha1:366239b8b9a2fbea3b6eae8dfc7b4a503d427e4c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py: Allocate parse nodes in chunks to reduce fragmentation and RAM use.</title>
<updated>2015-10-01T23:11:11+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-09-23T09:50:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=58e0f4ac50b3dc732cbfe0d7b04bb41951ac1329'/>
<id>urn:sha1:58e0f4ac50b3dc732cbfe0d7b04bb41951ac1329</id>
<content type='text'>
With this patch parse nodes are allocated sequentially in chunks.  This
reduces fragmentation of the heap and prevents waste at the end of
individually allocated parse nodes.

Saves roughly 20% of RAM during parse stage.
</content>
</entry>
<entry>
<title>unix-cpy: Remove unix-cpy.  It's no longer needed.</title>
<updated>2015-08-17T11:51:26+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-08-14T11:24:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=65dc960e3b22a8426e369607e47c19b380ce30ea'/>
<id>urn:sha1:65dc960e3b22a8426e369607e47c19b380ce30ea</id>
<content type='text'>
unix-cpy was originally written to get semantic equivalent with CPython
without writing functional tests.  When writing the initial
implementation of uPy it was a long way between lexer and functional
tests, so the half-way test was to make sure that the bytecode was
correct.  The idea was that if the uPy bytecode matched CPython 1-1 then
uPy would be proper Python if the bytecodes acted correctly.  And having
matching bytecode meant that it was less likely to miss some deep
subtlety in the Python semantics that would require an architectural
change later on.

But that is all history and it no longer makes sense to retain the
ability to output CPython bytecode, because:

1. It outputs CPython 3.3 compatible bytecode.  CPython's bytecode
changes from version to version, and seems to have changed quite a bit
in 3.5.  There's no point in changing the bytecode output to match
CPython anymore.

2. uPy and CPy do different optimisations to the bytecode which makes it
harder to match.

3. The bytecode tests are not run.  They were never part of Travis and
are not run locally anymore.

4. The EMIT_CPYTHON option needs a lot of extra source code which adds
heaps of noise, especially in compile.c.

5. Now that there is an extensive test suite (which tests functionality)
there is no need to match the bytecode.  Some very subtle behaviour is
tested with the test suite and passing these tests is a much better
way to stay Python-language compliant, rather than trying to match
CPy bytecode.
</content>
</entry>
<entry>
<title>py/parse: Fix handling of empty input so it raises an exception.</title>
<updated>2015-07-24T15:05:56+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-07-24T15:05:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=96f0dd3cbc404b7f96bd7a35247faea8da266638'/>
<id>urn:sha1:96f0dd3cbc404b7f96bd7a35247faea8da266638</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py/parse: De-duplicate and simplify code for parser "or" rule.</title>
<updated>2015-07-24T14:35:57+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-07-24T14:35:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=fa7c61dfab0822619451673d726a5b444d3a9d28'/>
<id>urn:sha1:fa7c61dfab0822619451673d726a5b444d3a9d28</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py: Improve allocation policy of qstr data.</title>
<updated>2015-07-14T21:56:32+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-06-13T20:53:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=ade9a052365247be5ed4ce8b53c2164a576a4a05'/>
<id>urn:sha1:ade9a052365247be5ed4ce8b53c2164a576a4a05</id>
<content type='text'>
Previous to this patch all interned strings lived in their own malloc'd
chunk.  On average this wastes N/2 bytes per interned string, where N is
the number-of-bytes for a quanta of the memory allocator (16 bytes on 32
bit archs).

With this patch interned strings are concatenated into the same malloc'd
chunk when possible.  Such chunks are enlarged inplace when possible,
and shrunk to fit when a new chunk is needed.

RAM savings with this patch are highly varied, but should always show an
improvement (unless only 3 or 4 strings are interned).  New version
typically uses about 70% of previous memory for the qstr data, and can
lead to savings of around 10% of total memory footprint of a running
script.

Costs about 120 bytes code size on Thumb2 archs (depends on how many
calls to gc_realloc are made).
</content>
</entry>
<entry>
<title>py: Clean up some bits and pieces in parser, grammar.</title>
<updated>2015-04-21T16:43:18+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-04-21T16:43:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=4735c45c511bf29ecb422456ca2ab0437e3c4ef0'/>
<id>urn:sha1:4735c45c511bf29ecb422456ca2ab0437e3c4ef0</id>
<content type='text'>
</content>
</entry>
</feed>
