05f12bfffa
In python 3, range() does what xrange() used to do and xrange() does not exist. If you want to write code that will run on both Python 2 and Python 3, you can't use xrange(). range() can actually be faster in some cases - eg. if iterating over the same sequence multiple times. xrange() has to reconstruct the integer object every time, but range() will have real integer objects. (It will always perform worse in terms of memory however) xrange() isn't usable in all cases where a real list is needed. For instance, it doesn't support slices, or any list methods. Change-Id: I5233438a864bb00d04ba7fb2b1688cacb0473691 |
||
---|---|---|
.. | ||
bytecode | ||
cli | ||
deadpathck | ||
eval | ||
grammar | ||
typeck | ||
README.md | ||
__init__.py | ||
emitter.py | ||
pass_manager.py |
README.md
Banana configuration language
This module contains everything related to Banana. In each
sub-module (sub-folder) you will find a README.md
file
that describes:
- Purpose of the module.
- The current status of the implementation.
- How testing is done.
The compiler is split in passes. Each pass performs some transformations and / or generates more data. Only the last step has side-effects on the Monanas instance.
Each sub-module roughly maps to one pass run by the compiler.
Passes
The Banana compiler runs the following passes:
parse
, parse the input and build an AST.typeck
, type check the input.deadpathck
, remove dead path in the connections.eval
, evaluate the AST generated.
Each pass makes some assumptions about the state of the data, and in particular that the previous passes have run successfully. While this is made obvious by the arguments required to run some passes, it is less so for others.
Generally, things to remember:
- Changing the ordering of passes is more likely to break things.
- New passes are free to modify the AST / TypeTable.
- New passes should not break invariants.
For more information on passes, have a look in their
specific README.md
file.