🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4510

Re: Need LEX & YACC 8-bit macro-assembler source files

#4510
From: Bill Cox
Date: Tue, 26 Dec 1995 04:03
46 lines
2365 bytes
Softec@system.abacom.it (Softec@system.abacom.it) wrote:
: I am developing a macro-assembler for a PIC microcontroller using LEX & 
: YACC compilers. Does anybody have some example source files (.l and .y) 
: for a generic 8-bit microcontroller?
: Thanks in advance. 

: 		Piero Poletto 

You could download the gas distribution from FSF sites near you.

Gas is the GNU assembler, which processes several dozens of assem-
bly languages (since it's the back end of the GNU C compiler, you
need a gas port every time you want a gcc port).  Sites in the States
are gatekeeper.dec.com and prep.ai.mit.edu.

About the only part of an assembler that needs lex/yacc (IMHO) is
the expression recognizer.  The rest of most assembly languages is
recognition of fixed strings (for opcodes, directives, etc.) and
recognition of user-defined names (program labels).  Lex/yacc aren't
the best tools for the above, but you could use cperf/gperf, which
provide the fastest lookup for a finite, fixed list of strings.
They're available from the GNU project also.

Usually, you'd like the input assembly language to match the chip
manufacturer's assembler (so you can steal^h^h^h^h^h port the most
code to your new assembler).  So there's no language design involved.

It's interesting to start designing an assembler from the output
side, so you should probably look at questions like:

	what sort of output does the linker/loader require?

	is there any reason to use the IEEE standard
	assembler output file format?  or Intel hex format?
	or Motorola S record format?

	should my output be compatible with the XYZ
	PROM programmer file format?

	will the output require encoded symbol definitions
	to support a debugger?

--
Bill Cox                            Software Janitor
Giving power and money to politicians is like giving
whisky and car keys to teenagers.      P.J. O'Rourke
Technical Details
Message-ID: <DK6Dy6.1EG@kithrup.com>
Path: arc1-ca.pugleaf.net!thuvia.qstools.com!bill
References: <4arnbe$hl7@server-b.cs.interbusiness.it>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!thuvia.qstools.com!bill
From: bill@thuvia.qstools.com (Bill Cox)
Subject: Re: Need LEX & YACC 8-bit macro-assembler source files
X-Newsreader: TIN [version 1.2 PL2]
Sender: news@kithrup.com (Mike Stump)
Nntp-Posting-Host: thuvia.qstools.com
Organization: Kithrup Enterprises, Ltd.
Message-ID: <DK6Dy6.1EG@kithrup.com>
References: <4arnbe$hl7@server-b.cs.interbusiness.it>
Date: Tue, 26 Dec 1995 04:03:42 GMT