> So far I only wrote up the RFC and kicked off a discussion here on the
> mailing list about it. As I wrote several times already, I'd appreciate
> someone tackling the implementation side to get a patch working!

> Cheers,

Hi Ben,

I think there is something wrong with how I set up my ML subscription,
I had to go to the newgroup to get this as it didn't show up in my
inbox.

Anyway, ye, I'm having a crack at it, although slow since it my first
go at php-src.

I've run into a bit of a problem though.

I managed to get the syntax working for class declarations:

class_declaration_statement:
                class_modifiers T_CLASS { $<num>$ = CG(zend_lineno); }
                T_STRING generics extends_from implements_list 
backup_doc_comment
'{' class_statement_list '}'
                        { $$ = zend_ast_create_decl(ZEND_AST_CLASS, $1, 
$<num>3, $8,
zend_ast_get_str($4), $6, $7, $10, $5); }
        |       T_CLASS { $<num>$ = CG(zend_lineno); }
                T_STRING generics extends_from implements_list 
backup_doc_comment
'{' class_statement_list '}'
                        { $$ = zend_ast_create_decl(ZEND_AST_CLASS, 0, $<num>2, 
$7,
zend_ast_get_str($3), $5, $6, $9, $4); }
;

class SampleMap<K, V>
{

}

So far so good, but function calls are more complicated.  I'm getting
error: shift/reduce conflicts

My guess is this due to the following scenario:

<?php

define('const_a', 1);
define('const_b', 2);

$result = const_a < const_b > (10);

While the intention might be to call a "function" const_a with the
generic type const_b and 10 as an argument, it is also identical to a
comparison expression.

The example above throws: Parse error: syntax error, unexpected '>'
since the expression is erroneous , so should that allowa generic type
to be included to the syntax?

Reply via email to