[ragel-users] [PATCH] D2 support

Johannes Pfau johannespfau at googlemail.com
Tue Dec 21 19:36:47 UTC 2010


On 21.12.2010 18:48, Adrian Thurston wrote:
> Is it expected thath D2 will ultimately supersede D1? This is the
> first that I've heard of there being a new major revision of the
> language.
>
> -Adrian
>
> On 10-12-21 02:10 AM, Johannes Pfau wrote:
>> 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.
>>
>>
>>
>>
>> _______________________________________________
>> 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
I'm not sure if D2 will really supersede D1. The language designers
(Walter and Andrei) definitely promote D2 a lot lately, but many D1
users don't want to switch to D2 (yet). D2 added so many new features
that it's sometimes considered as a completely new language. And the D1
compiler is also still supported; new bugfix releases are published
about every month.

-- 
Johannes Pfau


_______________________________________________
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