Re: Question about writing assemblers

Ian Lance Taylor <>
16 Feb 2000 23:41:20 -0500

          From comp.compilers

Related articles
Question about writing assemblers (Maliha Samad) (2000-02-15)
Re: Question about writing assemblers (David Lindauer) (2000-02-15)
Re: Question about writing assemblers (Sean Case) (2000-02-16)
Re: Question about writing assemblers (Ian Lance Taylor) (2000-02-16)
Re: Question about writing assemblers (2000-02-19)
| List of all articles for this month |

From: Ian Lance Taylor <>
Newsgroups: comp.compilers
Date: 16 Feb 2000 23:41:20 -0500
Organization: Compilers Central
References: 00-02-069
Keywords: assembler, design

In comp.compilers (Maliha Samad) writes:

>I am very confused as to whether I should write a hand coded assembler
>or should I use the existing tools like lex and yacc.

I've been working on the GNU assembler for several years.

I've never felt a need to use lex. Most assemblers accept a simple
line oriented syntax, and it is normally easy to pick out operands.

Only once have I seen a reason to use yacc. That was for the m68k
operand syntax. The m68k has a wide range of operand types, and for
historical reasons the GNU assembler supports two different operand
syntaxes. The original code to recognize both syntaxes was complex;
changing to yacc (work which I didn't start) made it quite a bit
clearer. Even then, the yacc parser was applied only to the operands;
picking out the operands themselves was done by a simpler procedure.

Of course what you should do depends upon the syntax you have to
Ian Taylor |

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.