Vidar Hokstad <vidar@hokstad.name> wrote:>tmk@netvision.net.il (Michael Tiomkin) wrote in message news:03-08-083...>> > [Write your parser with generic expression rules like this:>> >>> > expr: expr OP5 expr /* precedence 5 operator */>> >>> > Then when you define a new operator at level 5, have the lexer return>> > an OP5 for it with semantic info so the parser can figure out which>> > operator it was. I'm pretty sure this trick was used in extensible>> > languages before 1980. -John]>>>> Unfortunately, this will need 100 rules for 100 priorities.>> [It's true. But since a language with 100 priorities would be unusable,>> so what? -John]>>My solution to this problem years ago was to make the parser entirely>dynamic. Instead of hardwiring rules to specific priorities, I defined>almost the entire language I was working on in terms of operators with>variable priorities. I started out with arithmetic expressions, and>then went a little bit overboard and made everything including control>structures expressions that were defined by:

Since nobody seems to have mentioned it - Algol 68!

You clearly have gone further but, as far as I know, Algol 68 wwas the
source of all this.