[antlr-interest]

Nigel Sheridan-Smith nbsherid at secsme.org.au
Wed Jul 13 15:22:23 PDT 2005


-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Goran
Sent: Wednesday, 13 July 2005 4:05 PM
To: ANTLR Interest
Subject: [antlr-interest] 

 

Hi,

first I must say that I'm beginner in ANTLR (I writte few minor projects so
far, but nothing complicated), so please forgive me on this question but, I
just don't get it.
I have old assembler written manualy, and now I want to transfer it to
ANTLR, so, among other things I have situation like this:

Possible source combination:
    1.    aaa                        ; just mnemonic
    2.    aaa param              ; mnemonic and one param
    3.    aaa param, param   ; mnemonic and two params

when I write down following

statement
    : mnemonic (paramBlock)?
    ;    

paramBlock
    : expression (COMMA expression)?
    ;

parser does recognize options 2 and 3, but when I write

statement
    : mnemonic (paramBlock)*
    ;    

paramBlock
    : expression (COMMA expression)*
    ;

parser passes but on second statement (for example if I have 1 following 2)
he does not recognise aaa as mnemonic but as identifier.
So, I'm comfused with (xxx)? thas this means 0 or 1 (because this is not
functioning that way) or I miss something (what is probably the case :-) )




 

 

What’s the definition of “mnemonic” and “expression” rules?

Are mnemonics always keyword literals? There might be some confusion in the
parser between “aaa” and “expression”.

Nigel

--
Nigel Sheridan-Smith
PhD research student

Faculty of Engineering
University of Technology, Sydney
Phone: 02 9514 7946
Fax: 02 9514 2435
  

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20050714/897911b3/attachment.html


More information about the antlr-interest mailing list