|slightly off topic -- writing an assembler! SAMIGWE@worldnet.att.net (samuel) (1998-06-24)|
|Re: slightly off topic -- writing an assembler! firstname.lastname@example.org (1998-06-24)|
|Re: writing an assembler! email@example.com (John Lindsay) (1998-06-27)|
|Re: writing an assembler! firstname.lastname@example.org (1998-06-28)|
|Re: writing an assembler! email@example.com (Dr Richard A. O'Keefe) (1998-07-01)|
|Re: writing an assembler! firstname.lastname@example.org (Norman Ramsey) (1998-07-03)|
|Re: writing an assembler! telnet@wagner.Princeton.EDU.composers (1998-07-08)|
|From:||email@example.com (Henry Spencer)|
|Date:||28 Jun 1998 00:02:33 -0400|
|Organization:||SP Systems, Toronto, Canada|
Kirk Hays <firstname.lastname@example.org> wrote:
>IOW, you write the macro language interpreter, then write your
>assembler as a set of macro procedures describing all the
>instructions, their opcodes, and any assembly state that affects the
>emitted binary code... NEVER
>forget that the macro language is a string manipulation language.
>Look at a SNOBOL (or ICON, perhaps) manual to discover your string
>manipulation primitives. Keep the interpreter generic...
Even better: use an existing string-oriented extension language like
Tcl, instead of inventing your own macro-language interpreter. You
expend less effort and probably get a more satisfactory language.
(Control structures? Tcl has a full set, including a flexible
procedure mechanism. Pattern matching? Yup, full regular
expressions. Symbol tables? Tcl arrays are already an efficient
general-purpose table mechanism, scaling well to quite large sizes.
User procedures as full equivalents of builtins? Yup. And suitable
books, courses, newsgroups, consultants, and commercial support are
already available on the open market. Similar comments apply to
several other languages.)
For starters, you can simply implement the whole thing (including the
central pattern-match loop) in the string language. If performance
becomes an issue, then it *may* be worthwhile recoding key bits, like
the loop, in C or whatever. A lot of the time, it turns out *not* to
be worthwhile, and you've saved a lot of extra work. (And bosses,
users, etc., are a lot more tolerant of a working tool that's half as
fast as it should be than of a fast tool that only half works.)
Henry Spencer email@example.com
Return to the
Search the comp.compilers archives again.