<div dir="ltr"><div class="gmail_default" style="font-family:courier new,monospace;font-size:small">I've read some code in lexer.m (if this is the correct code that I should read) not so carefully, and found something I may misunderstand. Whereas, any help or comments is appreciated.</div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"> Best regards,<br>Xiaofeng Yang</div></div>
<br><div class="gmail_quote">2014-12-13 22:31 GMT+08:00 Xiaofeng Yang <span dir="ltr"><<a href="mailto:n.akr.akiiya@gmail.com" target="_blank">n.akr.akiiya@gmail.com</a>></span>:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="font-family:'courier new',monospace;font-size:small">Hi, all</div><div style="font-family:'courier new',monospace;font-size:small"><br></div><div style="font-family:'courier new',monospace;font-size:small">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.</div><div style="font-family:'courier new',monospace;font-size:small"><br></div><div style="font-family:'courier new',monospace;font-size:small">Do the differences between a string literal and a quoted name is only </div><div style="font-family:'courier new',monospace;font-size:small"> * quoted by single/double quotes</div><div style="font-family:'courier new',monospace;font-size:small"> * '' can appears in a quoted name (but not a string literal), whereas "" can appears in a string literal (but not a quoted name)<br></div><div style="font-family:'courier new',monospace;font-size:small">?</div><div style="font-family:'courier new',monospace;font-size:small"><br></div></div></blockquote><div><br></div><div><div class="gmail_default" style="font-family:'courier new',monospace;font-size:small">It seems to be Yes, right ?</div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="font-family:'courier new',monospace;font-size:small"></div><div style="font-family:'courier new',monospace;font-size:small"><br></div><div style="font-family:'courier new',monospace;font-size:small">I found some usage not be mentioned in the refman, e.g.</div><div style="font-family:'courier new',monospace;font-size:small"><br></div><div style="font-family:'courier new',monospace;font-size:small">I write "\\" but it interpreted as \\, this is not mentioned.</div></div></blockquote><div><br></div><div><div class="gmail_default" style="font-family:'courier new',monospace;font-size:small">This is a mistake I made in my proof-the-concept code. I use io.write not io.write_string so that the printed string is quoted. Sorry.</div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="font-family:'courier new',monospace;font-size:small">I write "\" but it errors while compiling, so how the backslash works?</div><div style="font-family:'courier new',monospace;font-size:small">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. </div></div></blockquote><div><br></div><div><div class="gmail_default" style="font-family:'courier new',monospace;font-size:small">\143 and \43 is a bug of the lexer. But for compatibility with NU-Prolog, this bug is leaving there. Right ?</div></div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="font-family:'courier new',monospace;font-size:small">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.</div></div></blockquote><div><br></div><div><div class="gmail_default" style="font-family:'courier new',monospace;font-size:small">The actual max value is \x10ffff\ and \4177777\. The value should not greater than 0x10ffff. This is not mentioned in the refman (the refman only specifies 0x10ffff at the paragraph which introduces \u and \U). Right ?</div></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="font-family:'courier new',monospace;font-size:small"><br></div><div style="font-family:'courier new',monospace;font-size:small">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.</div><div style="font-family:'courier new',monospace;font-size:small"><br></div><div style="font-family:'courier new',monospace;font-size:small"><span style="font-family:arial,sans-serif;font-size:14px"><br></span></div><div style="font-family:'courier new',monospace;font-size:small"><span style="font-family:arial,sans-serif;font-size:14px">Any help appreciated.</span><br></div><div style="font-family:'courier new',monospace;font-size:small"><br></div><div style="font-family:'courier new',monospace;font-size:small"><br></div><div><div> Best regards,<br>Xiaofeng Yang</div></div>
</div>
</blockquote></div></div></div>