[ragel-users] [PATCH] D2 support

Johannes Pfau johannespfau at googlemail.com
Tue Dec 21 10:10:39 UTC 2010


On 21.12.2010 07:22, Adrian Thurston wrote:
> Hi thanks for your patch! I'm hoping to integrate it in the next
> couple of weeks. At that time I'll look into the issue of dynamic
> arrays that you pointed out.
>
> Regards,
>  Adrian
>
> Johannes Pfau wrote:
>> Hello,
>> I attached a patch to add D2 support to Ragel. D2 is quite different
>> from D1 so I created new D2 subclasses in the cd* files. I chose -E for
>> the commandline switch, but it could be changed to something else. D2
>> also needs a special syntax for const pointers: const(uint)* is a
>> mutable pointer to a const uint. I introduced a PTR_CONST_END function
>> to generate that D2 output. The generated D2 code is entirely correct
>> now and I tested it with some HTML header parsers.
>>
>> There's one performance related problem though: In D2 a ubyte[] is
>> different from a ubyte[n], even if both arrays are initialized at
>> compile time. The ubyte[] generates a resizeable array at runtime, which
>> causes a performance problem. The ubyte[n] syntax should instead be used
>> for static constant arrays. But as ragel doesn't pass the number of
>> array entries to the OPEN_ARRAY function, there's no easy way to fix
>> that. So I wanted to ask for advice on how to implement that properly.
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> ragel-users mailing list
>> ragel-users at complang.org
>> http://www.complang.org/mailman/listinfo/ragel-users
>
> _______________________________________________
> ragel-users mailing list
> ragel-users at complang.org
> http://www.complang.org/mailman/listinfo/ragel-users
Great!
When I asked about the array issue in the D newsgroup someone reported
another problem with the codegen: The D compiler sometimes needs two {
around the action code to correctly recognize it as a scope. I attached
an updated patch.

-- 
Johannes Pfau

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ragel-d2.patch
Type: text/x-patch
Size: 20664 bytes
Desc: not available
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20101221/f6ef02a0/attachment-0001.bin>
-------------- next part --------------
_______________________________________________
ragel-users mailing list
ragel-users at complang.org
http://www.complang.org/mailman/listinfo/ragel-users


More information about the ragel-users mailing list