Re: Question about writing assemblers

David Lindauer <>
15 Feb 2000 22:13:42 -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: David Lindauer <>
Newsgroups: comp.compilers
Date: 15 Feb 2000 22:13:42 -0500
Organization: Bluegrass Net
References: 00-02-069
Keywords: assembler

Maliha Samad wrote:

> 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. The instruction
> set is written by my professor with almost 80 instructions. Can you
> please help me with this giving details of the pros and cons of

A lot depends on the specification of the assembly language. LEX would
probably provide a good foundation for the parsing process... but the
limited scope of an assembly language instruction kind of limits the
usefulness of YACC. If you have a lot of no-operand instructions you are
probably going to spend more time designing for YACC than you would just
coding it by hand. However, if you have lots of directives or a rich set
of addressing modes you can use YACC to good effect to do the parsing for
you... and that might save you time.

Two points - YACC and LEX are designed to be able to handle complicated
grammars, and most assembly languages are relatively simple grammar-wise.
Also you should factor in the time it will take you to learn to use these
tools effectively vs the amount of time it would take to code without them.

David Lindauer ICQ: 38422156 (computer page) (awareness page) (tao te ching)

Post a followup to this message

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