a re for asm file???

Hartmut Goebel h.goebel at crazy-compilers.com
Tue Oct 1 23:29:44 CEST 2002

jubafre at brturbo.com wrote:

> how can i make this re to find the labels and the instructions
> for a generic file.asm like the file above?????

I suggest using split():

while 1:
    l = file.readline():
    asm, comment = l.split(';', 1)
    asm = asm.split()
    if len(asm) == 2:
        instr, param = asm
        # label = None  # unused
        label instr, params = asm

If this is not enough, try John Aycock's generic small languages compiler
'spark' (http://www.csr.uvic.ca/~aycock/python/).

| Hartmut Goebel      | h.goebel at crazy-compilers.com               |
| crazy-compilers.com | compilers which you thought are impossible |

More information about the Python-list mailing list