Related articles |
---|
Writing Assembler! kwkhoo@tmi.com.sg (Khoo Kiak Wei) (1997-05-13) |
Re: Writing Assembler! john_sture@nortel.ca (1997-05-14) |
Re: Writing Assembler! clc5q@cs.virginia.edu (Clark L. Coleman) (1997-05-16) |
Re: Writing Assembler! rick@tip.nl (1997-05-17) |
Re: Writing Assembler! bullock@pcae.hep.phy.cam.ac.uk (Ben Bullock) (1997-05-17) |
Re: Writing Assembler! adrian@dcs.rhbnc.ac.uk (1997-05-17) |
Re: Writing Assembler! csusb@csv.warwick.ac.uk (Mr J R Hall) (1997-05-22) |
Re: Writing Assembler! jukkaj@ping.at (JUKKA) (1997-05-22) |
Re: Writing Assembler! cef@geodesic.com (Charles Fiterman) (1997-05-22) |
Re: Writing Assembler! mark@omnifest.uwm.edu (1997-05-25) |
Re: Writing Assembler! rick@tip.nl (1997-05-25) |
[12 later articles] |
From: | Ben Bullock <bullock@pcae.hep.phy.cam.ac.uk> |
Newsgroups: | comp.compilers |
Date: | 17 May 1997 00:09:16 -0400 |
Organization: | University of Cambridge, England |
References: | 97-05-156 |
Keywords: | assembler, parse |
Khoo Kiak Wei wrote:
> I am planning to write a generic assembler, as a work of learning
> flex and bison. However, after reading a book on Lex and Yacc, I am
> still confused on how should I start!?
Is it actually necessary or useful to use bison to write an assembler?
I can't think of where you need to use recursion, unless it's for some
kind of preprocessing.
Also, if you try and make a generic assembler, you are actually
dealing with several different languages.
This doesn't sound like a good place to use flex to me, because you
don't know what patterns you want to match at compile-time.
If you wanted to make an assembler for just one particular instruction
set it might be more useful to use flex.
> If any of you know of any sample code on assembler or good books talking
> on the assembler construction, I would like to hear from you please!
There are several freely available assemblers. One is the gnu generic
assembler gas. Another one is nasm, for intel x86 chips. Neither of
these use things like flex or bison though, except gas uses bison
somewhere for one particular chip (even then it says in the comments
that that is overkill).
--
Ben Bullock @ Cavendish Laboratory, University of Cambridge, UK.
email: bullock@hep.phy.cam.ac.uk
* FOAM = Fast Operating Algebraic Manipulator - read about it at
the foampage : http://pcae.hep.phy.cam.ac.uk/ben/foam/foam.html
download it : ftp://pcae.hep.phy.cam.ac.uk/pub/bullock/foam.tar.gz *
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.