Re: [RFC] [Discussion] Short Closures
| From: | Bob Weinand | Date: | Mon, 07 Sep 2015 01:19:08 +0000 |
| Subject: | Re: [RFC] [Discussion] Short Closures | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-88071@lists.php.net to get a copy of this message | ||
> Am 07.09.2015 um 02:59 schrieb Sara Golemon <php@golemon.com>:
>
> On Sep 6, 2015, at 07:01, Bob Weinand <bobwei9@hotmail.com> wrote:
>> Also, Hack is using a completely different parser, doesn't look like we could borrow
>> anything there.
>>
> True, Hack's parser is ocaml based and unrecognizable to the majority of this list. But
> HHVM's parser (which implements the runtime side of Hack), is a flex/bison parser, not just
> similar to, but actually directly descended from PHP 5.2's parser. Sure things have diverged
> since then, but the overall rule structure is nearly identical in spirit. Borrowing concepts should
> be trivial.
>
> -Sara
Oh, I thought that feature to be Hack-only. Looks like I'm wrong and hence looked at the wrong
place. [I always heard Hack has short Closures, but never was told HHVM had them too...]
But as I see you use a T_LAMBDA_OP which is inserted by a token-pre-parser before it's being
analyzed by the real parser. Wouldn't say we really could compare that. It's a lot of
complication... If I remember correctly, we had a similar reason back then to reject my initial
keywords as identifiers patch as it was using that type of approach.
Honestly, a %glr-parser bison directive would look cleaner here. But I'm not sure if we want to
go that route down as a LALR(1) has much more deterministic performance characteristics...
Bob