[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua and Saint-Exupery?
- From: David Given <dg@...>
- Date: Fri, 25 Feb 2005 22:56:09 +0000
On Friday 25 February 2005 21:23, Mark Hamburg wrote:
[...]
> By what syntactic rule would you recognize that this was the correct
> parsing? You have no type information available about any of the keywords
> above. How would you distinguish between a parsing of:
You don't. Functions are always left-associative.
The Bison rule would go something like:
expression:
leaf leftAssociativeOperator expression { ...+, -, etc... }
| expression rightAssociativeOperator leaf { ...*, /, etc... }
leaf:
atom '(' expressionList ')' { ...normal function call... }
| atom expression { ...bracketless function call... }
atom:
number
| string
| identifier
| '{' expressionList '}'
| etc
I *think* that's right... I way have gotten left associative and right
associative the wrong way round, though.
--
"Curses! Foiled by the chilled dairy treats of righteousness!" --- Earthworm
Jim (evil)