Re: 8051 assembler (Barton Christopher Massey)
Tue, 19 Mar 91 22:18:27 GMT

          From comp.compilers

Related articles
Re: 8051 assembler hgw@rht32.PCS.COM (h.-g. willers) (1991-03-12)
Re: 8051 assembler (1991-03-14)
Re: 8051 assembler mzenier@polari.UUCP (1991-03-15)
Re: 8051 assembler (1991-03-19)
| List of all articles for this month |

Newsgroups: comp.compilers
From: (Barton Christopher Massey)
Keywords: 8051, assembler, design, lex
Organization: Department of Computer Science, University of Oregon
References: <> <3502@polari.UUCP>
Date: Tue, 19 Mar 91 22:18:27 GMT

In article <3502@polari.UUCP> mzenier@polari.UUCP (Mark Zenier) writes:
> But not Lex or Flex. The implementation of include files at the
> yacc grammar level caused a such a messy conflict with the lookahead
> in both Flex and Decus Lex, that I ended up rewriting the the lexical
> analyzer by hand. Lex source isn't portable, especially if you
> play with the input() macro.

Hmm. The Motorola 56000 family assembly language has the interesting
property that label addresses may be used in preprocessor expressions(!).
In spite of this, I recently completed a 56K assembler written using LEX and
YACC -- it's actually compatible with LEX or FLEX, and YACC, BISON, or BYACC
(obviously, I tend to use FLEX and BYACC, but it needed to be portable to
some weird environments, such as Stanford's V OS).

It required some ifdefs, but other than that, the lexer was actually quite
straightforward. I had no serious trouble modifying the input routines
to switch between raw input and input from preprocessor output buffers.
It meant that the lexer only looked ahead a line at a time, but that's
about the best one can do anyhow, I think...

Pushing information back through the *parser*, on the other hand, was a
real nightmare, and still isn't quite right. Unfortunately, 56K expression
syntax is non-trivial, and having a machine-generated operand parser was
a real win.

Anyhow, although I sympathise with the above-quoted paragraph, I strongly
recommend using a FLEX lexer for an assembler -- my experience was much more

Bart Massey

Post a followup to this message

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