Hi! > The complexity of the current grammar is working against development.
I'm not sure that undertaking a task of rewriting whole grammar, with all disruptions etc. that this is going to cause, will speed up development a lot. But if you want to try it and show how easy it would be with your grammar - you are of course welcome. I agree that yacc parsers in general can be frustrating and complex, but I'm not convinced rewriting it really worth it and would result in something much simpler. > How many of those things really are distinct, and how many are an > artefact of the implementation? To pick just one a recent example: why > is the $x in "foreach($array as $x)" such a different beast from the $x > in "$x = $array[0]" that the latter could be replaced by "list($a, $b)" > but the former couldn't? Probably because parser wasn't written this way - list() is a special case in assignment (due to special handling required to implement it) but this special case was not part of foreach() parsing. $x is actually exactly the same thing in both cases - 'variable' - but list() is not 'variable' and as such needed special case. > Ah, so "r_variable" means "non-writable expression". Makes perfect > sense. Incidentally, "r_variable" expands to "variable", then to > "base_variable_with_function_calls", and _then_ to "function_call". I think more precisely it is "expression in read context". > Then again, $a->b->c is _also_ an "r_variable", so does that mean I > can't write "$a->b->c = 1;"? For me, it does not produce r_variable, instead I get compound_variable, and stack like this: $1 = nterm base_variable_with_function_calls () $2 = token "-> (T_OBJECT_OPERATOR)" () $3 = nterm @65 () $4 = nterm object_property () $5 = nterm @66 () $6 = nterm method_or_not () $7 = nterm variable_properties () -> $$ = nterm variable () But maybe I'm doing something different that you. Anyway, I think the discussion is getting a bit pointless here - I'm sure that in 10+ years of development there are places in the engine code where you could point and say "see? it is called variable but it does different thing!". Yes, I'm sure that happens. But I'm not sure I understand the point of picking out these things. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php