From: Gregory Ewing on 3 Mar 2010 01:52 > In article <Xns9D28186AF890Cfdnbgui7uhu5h8hrnuio(a)127.0.0.1>, > Giorgos Tzampanakis <gt67(a)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
From: member thudfoo on 3 Mar 2010 11:43 On Tue, Mar 2, 2010 at 10:52 PM, Gregory Ewing <greg.ewing(a)canterbury.ac.nz> wrote: >> In article <Xns9D28186AF890Cfdnbgui7uhu5h8hrnuio(a)127.0.0.1>, >> Giorgos Tzampanakis <gt67(a)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 > -- > http://mail.python.org/mailman/listinfo/python-list > I used Plex. The lexer is here: http://pastebin.com/9Rm4rDfu The target for the assembler is a toy single-byte processor.
First
|
Prev
|
Pages: 1 2 3 Prev: When will Python go mainstream like Java? Next: How to transmit a crash report ? |