[m-users.] Understanding string literals and name tokens

Xiaofeng Yang n.akr.akiiya at gmail.com
Sun Dec 14 01:31:27 AEDT 2014


Hi, all

I have confused by the Mercury Reference Manual (14.01.1). I found it seems
not so up-to-date with the implementation. Now I have some questions about
string literals and name tokens need to be helped.

Do the differences between a string literal and a quoted name is only
    * quoted by single/double quotes
    * '' can appears in a quoted name (but not a string literal), whereas
"" can appears in a string literal (but not a quoted name)
?


I found some usage not be mentioned in the refman, e.g.

I write "\\" but it interpreted as \\, this is not mentioned.
I write "\" but it errors while compiling, so how the backslash works?
I write "\143\" and it is interpreted as "c", this is what mentioned in
refman 2.3. But I write "\143" is also interpreted as "c", whereas "\43"
will interpreted as "#", these are what not mentioned in the refman.
I found the max value for the rule "\x....\" is \xfffff\, and the max value
for the rule "\....\" is \x777777\, this is what not mentioned in the
refman.

Do I miss something ? Or really not mentioned ? Or something I
misunderstand ? How can I understand all the syntax rules? Any resource I
could read? I'm doing some work on parsing Mercury code now (using some
lexer/parser generator), so, understanding all the syntax rules correctly
is the most important thing.


Any help appreciated.


     Best regards,
Xiaofeng Yang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20141213/bc4cec82/attachment.html>


More information about the users mailing list