[m-dev.] '|' as an operator

David Overton dmo at cs.mu.OZ.AU
Tue Feb 11 10:30:33 AEDT 2003


We have been using `|' as an operator in HAL using the SICstus reader
(which treats it the same as `;', except in lists).  Now that the HAL
compiler is compiling to Mercury, we are using lexer.m from the Mercury
library instead.  Unfortunately, lexer.m treats `|' as a special token
`ht_sep' so it is not possible to define it as an operator.

It would seem to me that `|' only needs to be treated as a special token
when we are inside a [ ... ] construct.  My plan is to change lexer.m so
that `|' produces the token `name("|")' and then changing parser.m to
use `name("|")' instead of `ht_sep' when parsing lists.  This would then
allow `|' to also be defined as an operator.

Can anyone see any problem with this?

David Overton                  Uni of Melbourne     +61 3 8344 1354
dmo at cs.mu.oz.au                Monash Uni (Clayton) +61 3 9905 5779
http://www.cs.mu.oz.au/~dmo    Mobile Phone         +61 4 0337 4393
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au

More information about the developers mailing list