On Mon, 2002-11-25 at 13:06, Michael Lazzaro wrote:
>     0x0         # ok, == 0
>     0x0.0       # ok
>     0x.0        # ok

Given that .1 is wrong (from above), I would disallow it here simply for
consistency sakes.

>     0d1.1E5     # WRONG, exp not allowed in shorthand radix
> 
>     0B0110      # WRONG, should be 0b0110
>     0O0123      # WRONG, should be 0o0123
>     0X00FF      # WRONG, should be 0x00FF
> 
> explicit radix:
> 
>     (radix 2-36)
> 
>     20#1gj       # base 20
>     20#1GJ       # base 20 (identical)
>     20#1:G:J     # base 20 (identical)
>     20#1_G_J     # base 20 (identical)
>     20#1:16:19   # base 20 (identical)
>     20#1_16_19   # NOT identical, == 20:11619
>     20#1:1_6:19  # WRONG: colon form may not have underlines
> 
>     20#0:0:1     # base 20
>     20#0:1       # base 20 (identical)
>     20#:1        # base 20 (identical) (leading : is ok)
>     :1           # WRONG, need radix specifier
>     20#          # WRONG, need at least an '0'
>     1#0          # WRONG, radix must be >= 2
> 
>     20#1_G.J     # ok, radix point (e.g. float) allowed
>     20#1:16.19   # ok, radix point (e.g. float) allowed
>     10#1.1E5     # WRONG, no exp notation in explicit radix
> 
>     -20#1GJ      # base 20 (negative)
>     -20#1:16:19  # base 20 (negative)
>      20#-1GJ     # WRONG, - is an operator, not part of the literal
> 
>    (radix 37-RADIX_MAX)
> 
>    256#0:253:254:255   # base 256
>    256#:253:254:255    # base 256 (identical)
>    256#0_253_254_255   # WRONG, digit 253254255 doesn't
>                        # exist in base 256.
> 
> 
> Other issues w/ literals:
> 
> - radix <= 36, alpha digits may be upper or lowercase
> - radix > 36, only colon form is allowed, not alpha digits
> - underlines may appear ONLY between digits
> - colon form may therefore not have underlines

No 'therefore'.  Your examples give such an example.

> - radix < 2 throws error

Is there a maximum?

> - negative sign goes before radix, e.g. -20#1GJ.
> - need to specify RADIX_MAX (platform dependent?)

I guess so.  :-)  May want to group those two.

> - explicit radix form may have radix point, '.',
>      but cannot use exponential notation ('e')
> 
> - can't have runtime radix, e.g. 2**8#10, because # binds tighter.
> - can't say (2**8)#10, because not a literal.
> 

The examples are good and extrapolate nicely, but has the grammar been
defined somewhere (in one form or another)?


-- 
Bryan C. Warnock
bwarnock@(gtemail.net|raba.com)

Reply via email to