From: Giorgos Tzampanakis on 22 Feb 2010 21:24 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?
From: Paul Rubin on 22 Feb 2010 21:33 Giorgos Tzampanakis <gt67(a)hw.ac.uk> writes: > 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? One "dead simple" option is the re module.
From: Lawrence D'Oliveiro on 22 Feb 2010 22:08 In message <Xns9D28186AF890Cfdnbgui7uhu5h8hrnuio(a)127.0.0.1>, Giorgos Tzampanakis 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. 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.
From: Tim Roberts on 23 Feb 2010 00:57 Paul Rubin <no.email(a)nospam.invalid> wrote: > >Giorgos Tzampanakis <gt67(a)hw.ac.uk> writes: >> 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? > >One "dead simple" option is the re module. Yes, indeed. I have implemented TWO different FPGA-based microassemblers in Python using the essentially undocumented but magically delicious re.Scanner class. Simple and flexible. -- Tim Roberts, timr(a)probo.com Providenza & Boekelheide, Inc.
From: mk on 23 Feb 2010 10:00 Giorgos Tzampanakis 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'm not sure about your field of application (never done anything like that), but I found pyparsing highly usable. Regards, mk
|
Next
|
Last
Pages: 1 2 3 Prev: When will Python go mainstream like Java? Next: How to transmit a crash report ? |