[antlr-interest]

Goran antlr at raf.hr
Tue Jul 12 23:04:50 PDT 2005


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 :-) )

I'm using ANTLR 2.5.7 and K=2

thx
Goran
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20050712/c9625d90/attachment.html


More information about the antlr-interest mailing list