speed vs. re2c?

Adrian Thurston thurs... at cs.queensu.ca
Fri Oct 6 03:06:08 UTC 2006


Okay, I get it now. That seems like an interesting idea. From the point 
of view of Ragel it's very doable. I can say that to make Ragel into a 
library would expose my poor memory management discipline :) So far I've 
enjoyed the luxury of program termination upon completion.

Please do keep me posted on any developments.

Cheers,
  Adrian

Joshua Haberman wrote:
> Adrian,
> 
> Let me try to clarify what I'm talking about.  The traditional use of
> re2c or Ragel is:
> 
> COMPILE TIME: c-compiler(ragel(regex)) -> binary that can parse regex
> 
> I am proposing:
> 
> COMPILE TIME: c-compiler(ragel) -> library that can generate
> regex-parsing code
> RUN TIME: ragel-library(regex) -> machine code in memory I can jump to
> to parse regex
> 
> An API for Ruby would look something like:
> 
> myparser = Ragel::Machine.new("number = (
>     [0-9]+ $dgt ( '.' @dec [0-9]+ $dgt )?
>     ( [eE] ( [+\-] $exp_sign )? [0-9]+ $exp )?
>    ) %number;")
> 
> myparser.actions["dgt"] = Proc.new { |dgt| puts "DGT: #{dgt}" }
> 
> myparser.run(File.open("foo.txt"))
> 
> Specifically:
> 
> - I can use Ragel from an interpreted language, without having to
> compile every pattern with a C compiler (like Mongrel does)
> 
> - I can write my actions in the target language
> 
> - it's faster than a table-based re engine, like what I would get by
> saying: file.read =~ /blah/
> 
> Is this more clear?
> 
> Thanks,
> Josh
> 
> 
> 



More information about the ragel-users mailing list