Re: Question about writing assemblers

Ian Lance Taylor <ian@zembu.com>
16 Feb 2000 23:41:20 -0500

          From comp.compilers

Related articles
Question about writing assemblers maliha032@yahoo.com (Maliha Samad) (2000-02-15)
Re: Question about writing assemblers camille@bluegrass.net (David Lindauer) (2000-02-15)
Re: Question about writing assemblers gsc@zip.com.au (Sean Case) (2000-02-16)
Re: Question about writing assemblers ian@zembu.com (Ian Lance Taylor) (2000-02-16)
Re: Question about writing assemblers nr@wally.eecs.harvard.edu (2000-02-19)
| List of all articles for this month |

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

In comp.compilers maliha032@yahoo.com (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
parse.
--
Ian Taylor | ian@airs.com


Post a followup to this message

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