Re: parsing with user defined operators

rspartan <rspartan@my-deja.com>
27 Aug 1999 01:49:47 -0400

          From comp.compilers

Related articles
parsing with user defined operators rwg@exoterica.com (1999-08-12)
Re: parsing with user defined operators torbenm@diku.dk (Torben Mogensen) (1999-08-13)
Re: parsing with user defined operators mfinney@lynchburg.net (1999-08-15)
Re: parsing with user defined operators Andrew.Walker@nottingham.ac.uk (Dr A. N. Walker) (1999-08-27)
Re: parsing with user defined operators rspartan@my-deja.com (rspartan) (1999-08-27)
Re: parsing with user defined operators darcy@moa.CS.Berkeley.EDU (1999-08-28)
| List of all articles for this month |

From: rspartan <rspartan@my-deja.com>
Newsgroups: comp.compilers
Date: 27 Aug 1999 01:49:47 -0400
Organization: Deja.com - Share what you know. Learn what you don't.
References: 99-08-053 99-08-057 99-08-068
Keywords: syntax, practice

> I'm looking for parsing techniques to handle expressions that include
> user defined operators and overloaded operators. The precedence
> levels of operators are user definable over a range of several hundred
> values. The associativity is user definable as well. Any pointers to
> books or articles are more than welcome.


Do not complicate life yourself !
You don't specify what kind & purpose of language you're designing,
but defining new operators could be both easy/difficult.


My suggestion is to copy the C++ approach :
1. Define several operators.
2. Each one of those operators can be overload
with different type parameters.
3. Cannot change operators associativity or precedence.


Otherwise, you'll make the life difficult for the language designer
(that's YOU) & the language user (the programmer).


In the second approach, You'll need complicated grammar techniques &
the programmer will have problems when trying to write an expression,
and remember each operator precedence.


Just my thoughts, Good Luck.


rspartan@my-deja.com


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.