On Thursday, June 26, 2003, at 08:00 PM, John J. Allison wrote:


One problem is that the Java,C,C++,etc grammars all have full
unary expressions represented. VTL only has logical not, with
the unary minus for a negative number included in NUMBER_LITERAL.

Right, but these languages do constant expression evaluation at run time, which VTL doesn't do (or does it?). Languages are more or less evenly divided between signed literals vs. unsigned literals with unary minus (and plus).



Keeping close to current VTL grammar, here's the hard part:


|
<FLOATING_POINT_LITERAL:
    ("-")? (<DIGIT>)+ "." (<DIGIT>)* (<EXPONENT>)?
  | ("-")? "." (<DIGIT>)+ (<EXPONENT>)?
  | ("-")? (<DIGIT>)+ <EXPONENT>

|
<#EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >

Can third case be folded into the first one, like this:


("-")? (<DIGIT>)+ ("." (<DIGIT>)*)? (<EXPONENT>)?

Also, maybe the grammar should permit a leading '+' in numeric literals (many languages do, for regularity's sake).

As for div operator, I say use "div". \ is the escape,
and the other unused characters are not intuitive,
i.e. not used by (m)any other languages.

The problem with "div" is that modulus is not called "mod" but "%". Another problem was extreme reluctance to add new constructs to the grammar, for reasons of backwards-compatibility. I'd say that a word-like operator is more suspicious than a symbolic one, but it's just a guess. What about "//"?


Mat�as.


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to