home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.compilers      Compiler construction, theory, etc. (Mod      2,753 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,191 of 2,753   
   =?iso-8859-1?b?RnLpZOlyaWM=?= to All   
   Work around ambiguities in LL(1) assembl   
   06 Jan 08 18:04:15   
   
   From: m@il.it   
      
   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.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca