|LL(1) and common-heads... email@example.com (1995-12-28)|
|LL(1) and common-heads... firstname.lastname@example.org (Gabor DEAK JAHN) (1995-12-30)|
|Re: LL(1) and common-heads... email@example.com (1996-01-12)|
|Re: LL(1) and common-heads... firstname.lastname@example.org (1996-01-14)|
|Re: LL(1) and common-heads... Osman.Buyukisik@ae.ge.com (U-E59264-Osman Buyukisik) (1996-01-15)|
|From:||email@example.com (Duane Sand)|
|Date:||14 Jan 1996 18:51:30 -0500|
>Hi all, I've written an actual assembler for this new OS that
>a bunch of us are trying to get off the ground (originally from
>r.g.p.). Anyhow, the assembler works fine, but I'm not using any
>parsing algorithms like LL(1) or SLR. I was wondering if it would be
>of any use writing it using LL(1). Or would anyone suggest a better
firstname.lastname@example.org (Michael Parkes) writes:
>It looks to me like you are using the wrong tool for the job. If I
>understand you correctly this is a semantic problem and should be dealt
>with as such. Try using an attribute grammar that supports 'sparse'
>tables. This will allow you to define the valid semantic mappings and
>will vastly simplify the syntax processing. The basic job should only
>require about 2,000 lines.
If you've got your assembler working, why mess with it further at all?
Is it too slow? Too fast? Too big? Too small? Too simple? Too
inelegant? Completed too soon?
Most assemblers have so little syntax that BNF-based methods are
overkill and will double the complexity of the "parse". You should
pick some compact tabular way to relate opcode names and operand
patterns and instruction bit patterns, and not worry about fancy
algorithms at all.
The 2000 source line suggestion is very inflated. By comparison,
implementations of the Forth language typically have a built-in
assembler included, which is typically about 200 lines of source code
for current machines. Of course they cheat, by using a rational
nontraditional syntax for the instructions, and using a compact
language, and building on top of a simple but powerful
[Good point. You should be able to write an entire assembler in 2000 lines.
Return to the
Search the comp.compilers archives again.