|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000381||mercury||Bug||public||2015-03-01 00:09||2015-07-15 12:07|
|Platform||Some Lenovo i5 laptop or other||OS||Linux Mint||OS Version||15|
|Target Version||Fixed in Version|
|Summary||0000381: Compiler deals poorly with '.' character constants.|
|Description||Unifying variables with '.' causes compiler to fail with "operator precedence error".|
|Steps To Reproduce||Compile attached code. If line 10 is not commented out (as uploaded) the compiler will explode. If line 10 is commented out, the compiler is happy.|
|Additional Information||Mercury Compiler, version rotd-2015-02-20, on x86_64-unknown-linux-gnu|
|Tags||No tags attached.|
Mercury has no specific lexical syntax for character literals - they are just terms with arity 0, whose identifiers have length 1.
Single lower case characters are valid identifiers, and so are all operators defined in the operator table. Any other character needs to be enclosed in single-quotes to be a valid identifier, otherwise it won't be treated as a character literal.
Single-character operators in the operator table don't need the quotes, as they are already valid identifiers. However, operators in this table never have arity zero, so they won't be treated as character literals anyway, unless parentheses are used to override the operator table in the usual way. That is the problem in bug.m.
Hence this issue is not a bug, it is intended behaviour. However, it is a common problem for users, and if Mercury had specific syntax for character literals this common problem would be avoided. So perhaps this issue should be considered a feature request for character literal syntax?
|2015-03-01 00:09||ttmrichter||New Issue|
|2015-03-01 00:09||ttmrichter||File Added: bug.m|
|2015-07-15 12:07||mark||Note Added: 0000844|