[ragel-users] Parsing From Ring Buffers

Adrian Thurston thurs... at cs.queensu.ca
Fri Aug 8 16:37:27 UTC 2008


Yeah, that shouldn't be too hard. In fact it is already done for java and
ruby code generators due to the lack of pointers. These languages only
have table-based drivers though and since you are after speed you probably
want to make it work with -G2. Should be straightforward. Send the results
here if you try it :)

Adrian


On Thu, 31 Jul 2008, William Ahern wrote:

>
> Cursorily looking at the generated code, it appears to be deceptively easy
> to turn `p', `pe', and `eof' into indexes, rather than pointers, given the
> `fpc' macro. Perhaps by simply adding a second macro to increment and
> decrement the index?
>
> Am I missing anything that would throw a monkey wrench into such a patch?
> This could make scanners more efficient, because there would be no need to
> use memmove().
>
> It might even work without a patch, but technically it's undefined behavior
> in C to derive pointer values outside arrays or malloc'd blocks. Compilers
> like TinyCC have the ability to catch such errors, which can be useful when
> tracking down bugs. But to keep from having to re-adjust `ts' and `te', and
> so that Ragel sees a linear input space during scanning, the indexing would
> have to extend beyond the ring buffer (and fpc would just be a simple
> modulus operation).
>
>
> >



More information about the ragel-users mailing list