On 01/23/2014 10:06 AM, Daniel Murphy wrote:
"OP"  wrote in message news:[email protected]... I
just looked at parse.c and I had no idea there is a precedence table.
Why is there one rather than it being embedded like a switch statement
which tries to handle all the higher precedence operations calling a
function running the next set of precedence? I guess that does sound
like a loop/table but I imagined it in switch statements.

The precedence table is mostly just used for leaving off redundant
parens when printing expressions, not for parsing.

Encoding precedence by function calls is unnecessarily wasteful though. (e.g. "a.b" requires roughly 14 recursive function calls to be parsed by such a scheme.)

Reply via email to