# HG changeset patch # User Windel Bouwman # Date 1386940210 -3600 # Node ID e95e5572cd6de126b8ffc0147d61e33ad043a4b7 # Parent 68b01c8abf8af2041e2f2f189a15ca544881fdcf Added utils doc page diff -r 68b01c8abf8a -r e95e5572cd6d doc/compiler.rst --- a/doc/compiler.rst Fri Dec 13 13:51:02 2013 +0100 +++ b/doc/compiler.rst Fri Dec 13 14:10:10 2013 +0100 @@ -36,7 +36,7 @@ The intermediate representation (IR) of a program de-couples the front end from the backend of the compiler. -See ir for details about all the available instructions. +See :doc:`ir` for details about all the available instructions. C3 Front-end @@ -56,7 +56,7 @@ 99 [label="IR-code object"] 1 -> 10 10 -> 20 - 20 -> 40 [label="AST tree"] + 20 -> 40 40 -> 99 } diff -r 68b01c8abf8a -r e95e5572cd6d doc/index.rst --- a/doc/index.rst Fri Dec 13 13:51:02 2013 +0100 +++ b/doc/index.rst Fri Dec 13 14:10:10 2013 +0100 @@ -6,25 +6,11 @@ Welcome to lcfos's documentation! ================================= -Contents: - .. toctree:: :maxdepth: 2 readme_link design compiler - ir - - ->>> from utils import HexFile ->>> h = HexFile() - + utils -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` - diff -r 68b01c8abf8a -r e95e5572cd6d doc/utils.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/utils.rst Fri Dec 13 14:10:10 2013 +0100 @@ -0,0 +1,20 @@ + +Utilities +========= + +Hexfile manipulation +-------------------- + + +.. autoclass:: utils.HexFile + + +>>> from utils import HexFile +>>> h = HexFile() +>>> h.dump() +Hexfile containing 0 bytes +>>> h.addRegion(0, bytes([1,2,3])) +>>> h +Hexfile containing 3 bytes + + diff -r 68b01c8abf8a -r e95e5572cd6d python/ppci/ir.py --- a/python/ppci/ir.py Fri Dec 13 13:51:02 2013 +0100 +++ b/python/ppci/ir.py Fri Dec 13 14:10:10 2013 +0100 @@ -2,6 +2,7 @@ Intermediate representation (IR) code classes. """ + class Module: """ Container unit for variables and functions. """ def __init__(self, name): @@ -369,6 +370,7 @@ def setTarget(self, t): self.Targets[0] = t + target = property(lambda s: s.Targets[0], setTarget) def __repr__(self):