Writing an assembler in Python

Gregory Ewing greg.ewing at canterbury.ac.nz
Wed Mar 3 07:52:02 CET 2010


> In article <Xns9D28186AF890Cfdnbgui7uhu5h8hrnuio at 127.0.0.1>,
> Giorgos Tzampanakis  <gt67 at hw.ac.uk> wrote:
> 
>>I'm implementing a CPU that will run on an FPGA. I want to have a
>>(dead) simple assembler that will generate the machine code for
>>me. I want to use Python for that. Are there any libraries that
>>can help me with the parsing of the assembly code?

I wrote a PIC assembler in Python once. I didn't bother
with any parsing libraries. I used a regular expression
to split the input into tokens, then wrote ad-hoc
parsing code in Python.

-- 
Greg



More information about the Python-list mailing list