Related articles |
---|
Work around ambiguities in LL(1) assembler parser m@il.it (=?iso-8859-1?b?RnLpZOlyaWM=?=) (2008-01-06) |
Re: Work around ambiguities in LL(1) assembler parser wyrmwif@tsoft.org (SM Ryan) (2008-01-07) |
Re: Work around ambiguities in LL(1) assembler parser DrDiettrich1@aol.com (Hans-Peter Diettrich) (2008-01-07) |
Re: Work around ambiguities in LL(1) assembler parser gene.ressler@gmail.com (Gene) (2008-01-07) |
From: | =?iso-8859-1?b?RnLpZOlyaWM=?= <m@il.it> |
Newsgroups: | comp.compilers |
Date: | Sun, 6 Jan 2008 18:04:15 -0500 (EST) |
Organization: | Guest of ProXad - France |
Keywords: | assembler, question, parse |
Posted-Date: | 06 Jan 2008 18:04:15 EST |
Hi,
Writing an assembler, I'm stuck with ambiguities with my syntax. The
syntactic analysis is a simple LL(1) recursive descent parser. Here is
the issue (look at the "(" as a FIRST)
LDA (data),Y ; #1 Indirect address indexed by Y
index EQU 123
LDA (index-1)*3,Y ; #2 Absolute address indexed by Y
LDA 3*(index-1),Y ; Equivalent but non ambiguous
An except of the grammar :
line = mnemonic oper
oper = "(" addr ")" "," "Y"
| addr "," "Y"
addr = ["+"|"-"] term { ["+"|"-"] term }
... etc
The "(" of the _oper_ rule conflicts with the one from the _addr_
expression. Do I get this right ?
Is there a work around ?
Thanks for your time.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.