|Assembler using Lex/Yacc email@example.com (Sanky) (2005-12-03)|
|Re: Assembler using Lex/Yacc firstname.lastname@example.org (russell kym horsell) (2005-12-05)|
|From:||russell kym horsell <email@example.com>|
|Date:||5 Dec 2005 02:53:36 -0500|
|Organization:||Central Iowa (Model) Railroad, Plano, TX, USA|
|Posted-Date:||05 Dec 2005 02:53:36 EST|
Sanky <firstname.lastname@example.org> wrote:
> I was working on an assembler for X64 architecture. I was wondering
> what are the tradeoffs in designing an assembler using lex or re2c and
> yacc? Why is that handwritten assemblers are more popular than those
> developed using lex/yacc? Developing a grammar is the toughest part,
> but once you have a grammar ready, I think the rest of the routines are
I've written several of both (incl some full-blown ones generating proprietary
multi-seg relocatable binaries) and there seems no good reason -- apart from
lethargy and pride -- not to use the tools.
I don't know what you mean by "tough" to design assembler syntax. ;-)
The only overhead I'd imagine is the learning curve. A rec descent
parser requires almost 0 learning. Getting yacc and lex to do same
requires knowing how to handle end-of-lines (i.e. whatever
record-oriented processing is required for your assembler -- usually
getting the listing right!), etc.
Return to the
Search the comp.compilers archives again.