Writing an assembler in Python

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Wed Feb 24 00:11:26 CET 2010

In message <da970fce-bd6b-4eb3-bb66-3ca52cc0fd4a at k5g2000pra.googlegroups.com>, Anh Hai Trinh wrote:

> On Feb 23, 10:08 am, Lawrence D'Oliveiro <l... at geek-central.gen.new_zealand> wrote:
>> Let me suggest an alternative approach: use Python itself as the
>> assembler. Call routines in your library to output the code. That way you
>> have a language more powerful than any assembler.
>> See <http://github.com/ldo/crosscode8> for an example.
> SyntaxError: Non-matching "#end if" in crosscode8.py:345

What mismatch? Line 345 is the last line of this routine:

    def org(self, addr) :
        """sets the origin for defining subsequent consecutive memory contents."""
        self.lastaddr = self.curpsect.origin
        return self # for convenient chaining of calls
    #end org

More information about the Python-list mailing list