syntax idea: simplifed ifs

Derek Parnell derek at psych.ward
Tue Apr 11 01:43:03 PDT 2006


On Tue, 11 Apr 2006 04:14:49 -0400, Chris Miller wrote:

> On Mon, 10 Apr 2006 18:04:21 -0400, dennis luehring <dl.soluz at gmx.net>  
> wrote:
> 
>> for example how often do we use constructs like
>>
>> if( x ==  10 && x == 20 && x == 30 )
>>
>> simplified:
>> if( x == [10 && 20 && 30] )
>>
>> if( a >= h && b >= h && c >= h )
>>
>> simplified:
>> if( [a && b && c] >= h )
>>
>> (just an idea)
>>
>> ciao dennis
> 
> The suggestions parse as arrays, which is unfriendly to context-free  
> grammar...
> 
> static int[] foo = [1 && 2 && 3];
> static int[] bar = [ 1, 2, 3 ];
> writefln(foo, bar);

I wouldn't get too hung up be the specific syntax quite yet ;-) But is the
concept a good idea????

  Compound_expr :: Expr Rel_op Expr_set
  Compound_expr :: Expr_set Rel_op Expr
  Expr_set      :: Es_prefix Es_list Es_suffix
  Es_list       :: Expr Es_bool_expr ...
  Es_bool_expr  :: Bool_op Expr

Now all we have to do is define what the prefix and suffix is.

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocracy!"
11/04/2006 6:35:57 PM



More information about the Digitalmars-d mailing list