[ragel-users] integrating ragel w/ bison

Adrian Thurston thurs... at cs.queensu.ca
Wed Jan 3 20:36:28 UTC 2007


Hi Jason, all the scanner examples I have use the push model. To write a
pull-based scanner you'll need to use the fbreak; statement to break out of
the processing loop. You can then return from the scanner function. You
can't use a C return statement in a scanner action because it will leave the
scanner in an inconsistent state. The fbreak statement does a little cleanup
first.

How does it work in re2c? Do you just give a C return from the pattern action?

For a long time I've been meaning to add a version of fbreak that cleans up
then issues a C return but I don't know what to call it because there
already is fret which returns from an fcall. I might just make it

fbreak_return value;

even though that's very long. But it could also be extended to include

fbreak_goto label;

to jump to somewhere else in your function. Do you think that's clear? I
wouldn't want these to be confused with fret and fgoto.

Regards,
 Adrian

Jason wrote:
> 
> I have a good bit of experience writing grammars using re2c and bison
> but I really like the clarity of ragel and would like to use it as a
> replacement for re2c.
> 
> Are there any examples (e.g. the quintessential calculator) using ragel
> as the lexical frontend to bison?
> 
> thanks,
> Jason
> 
> 
> 



More information about the ragel-users mailing list