views:

9

answers:

0

Hi All,

I've got this little COCO/R grammar fragment that roughly mimics the syntax of c-style languages for expressions (only vastly simpler). But for some reason, it refuses to parse a compound expression. Perhaps it's been a long week, or perhaps I'm missing something totally obvious. I've boiled the Expression grammar down as much as I can, but it still seems to be wrong. What's wrong with it? I can't see anything wrong with it.

Here're the relevant parts of the grammar:

PropertyDeclaration 
    = 
    ident 
        '=' 
        Expression 
    ';' 
    .

Expression
    =
    Value [ BinaryOperator Expression ]
    | '(' Expression ')'
    .

Value = 
      DottedIdentifier
    | DateTime
    | DateTimeOffset
    | realCon
    | Guid
    | intCon
    | stringCon
    | Boolean 
    .

And here's what it fails to parse:

    PropName8 = PropName3 + (6.4E10 / PropName5); // expressions

some of these lexer tokens (like ident, stringCon, and realCon) are taken mostly unmodified from the C# 3.0 grammar available on the coco/r site. It successfully parses all the examples of my non-compound expressions, but as soon as I get to the '+' it complains with:

-- line 101 col 31: scolon expected

Any ideas?