John,

Wow-- thanks for the head start!

I agree, no for hex and octal literals (for the moment at least).  Adds
complexity and there's just not the same compelling need by the typical
template writer.

WILL

----- Original Message ----- 
From: "John J. Allison" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 26, 2003 4:00 PM
Subject: Velocity Numerics : Floating Point Literals


> Will,
>
> I took a quick look around some other JavaCC grammars.
> Don't call it "Decimal Literal", that means base-10 integer in
> all the other JavaCC grammars. Call it Floating Point Literal,
> i.e. FLOATING_POINT_LITERAL in Parser.jjt.
>
> I would steal the syntax from Java, and the latest JavaCC for Java 1.4,
> http://www.cobase.cs.ucla.edu/pub/javacc/java1_4c.jj
> except that I don't think we need support for l/L suffix to specify long,
> f/F for float and d/D for double.
> All integer-like numbers would be Integer and all decimal/real numbers
> would be Double.
>
> 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.
>
> 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"])+ >
>
> In Parser.jjt, put that after line 923, "|   <NUMBER_LITERAL ...".
> Find the other NUMBER_LITERAL lines and mimic for FLOATING_POINT_LITERAL.
> Fill out ASTFloatingPointLiteral.java to create a Double and
> move the file into node/ as directed by BUILD_README.txt.
>
> I'd finish it off but I'm off on vacation next week and don't
> have time before then.
>
>
> Should we add support for hex and octal literals to be complete,
> making them into Integer? 10 == 0xA == 012
> No, at least not until VTL has bitwise operators that would
> really make use of them.
>
> 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.
>
> John Allison
> [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


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

Reply via email to