Anyone interested in a Spirit for D?

Bill Baxter dnewsgroup at billbaxter.com
Wed Oct 18 17:25:16 PDT 2006


Richard Koch wrote:
> Bill Baxter wrote:
>> Walter Bright wrote:

>> // spirit:
>> num_p >> *( ch_p(',') >> num_p)
>>
>> // C#
>> Ops.Seq( Prims.Digit, Ops.Start( Ops.Seq(Prims.Ch(','), Prims.Digit)))
>>
>>
> all that is cool, but (i know i am the dummy here) readability as in bnf 
> is something that eludes me. better to go for coco?
> 

You mean this coco?
http://www.ssw.uni-linz.ac.at/Coco/

Not sure what you mean by coco being more readable than BNF.  Coco's 
grammar looks pretty much like BNF to me.

----- from Taste.atg -----
VarDecl                  (. wchar_t* name; int type; .)
= Type<type>
   Ident<name>            (. tab->NewObj(name, var, type); .)
   { ',' Ident<name>      (. tab->NewObj(name, var, type); .)
   } ';'.
--------------------------

As far as I can tell that's just good old EBNF with some notations.
    VarDecl ::= Type Ident ("," Ident)* ";"

--bb



More information about the Digitalmars-d mailing list