www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Ragel


Anybody have any sample Ragel state machines they've developed for 
lexing, oh, say, D code?  I'm very much a learn-by-example kinda guy. 
You can show me all the docs you like, but it won't mean nuthin til I 
see a real working example. =P

I think Ragel employs a fantastic method to define language grammars 
easily, reliably, and readibly.  I really like the fgoto, fret, fcall 
instructions...now that's power.

I just recently toyed with the D code generation and found a bug.  D 
treats the expression `p = (tokend)-1` as a C-style cast of `-1` to a 
type of `tokend`.  `tokend`, however, was clearly defined as a `char*` 
variable, so it is not a C-style cast as the compiler assumed it was. 
Maybe just remove that deprecation check, or rather have it more 
thoroughly check for truly ambiguous code (i.e. when tokend is actually 
supposed to be a type).

So, naturally I reported this bug to Adrian and a patch came back within 
the hour.  Sweeet.

James Dunne
Jan 23 2006