<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 2012.07.02. 2:41, Richard O'Keefe
wrote:<br>
</div>
<blockquote
cite="mid:DA4C1DE1-B00A-4053-9F2E-69A501BC444A@cs.otago.ac.nz"
type="cite">
I find it hard to imagine a parser that would confuse them.
Commas can occur in three contexts: f( .... , ... ) where f is an
atom immediately adjacent to a left parenthesis; [ ... , ... ]
where the comma separates list elements; ... , ... anywhere else.
</blockquote>
You are right, it is easy to distinguish between them, but not with
the rules described on the <a
href="http://www.mercury.csse.unimelb.edu.au/information/doc-release/mercury_ref/Terms.html">Terms.html</a>
and the <a
href="http://www.mercury.csse.unimelb.edu.au/information/doc-release/mercury_ref/Builtin-Operators.html#Builtin-Operators">Builtin-Operators.html</a>
disagree with the precedence rules. It was not too hard to make this
<a
href="https://gist.github.com/3025801/2b48f39914721191f0f3cad9ad2c2520a62bfbf5">change</a>,
just I am not sure it will be ok. (The previous versions could not
properly parse expressions like ":- pred main(io::di, io::uo) is
det.", because of the precedence rules, or maybe I did something
wrong during the formulation.)<br>
<br>
<blockquote
cite="mid:DA4C1DE1-B00A-4053-9F2E-69A501BC444A@cs.otago.ac.nz"
type="cite">
<blockquote type="cite">
<pre wrap="">- I think the . has also double meaning, but maybe I do misunderstand
something:
</pre>
</blockquote>
<pre wrap="">
Yes. A token that is a dot followed by white space is an end of term
token; other dots are not.</pre>
</blockquote>
Thanks, this was not clear from the reference.<br>
<blockquote
cite="mid:DA4C1DE1-B00A-4053-9F2E-69A501BC444A@cs.otago.ac.nz"
type="cite">
<pre wrap=""> Tokens may be made of sequences of symbols
like ++, +*@, and even .. and ./* are possible tokens. However, such
a sequence may not include %, so we'd expect "x.% foo!" to be a well
terminated clause as it is in Prolog.</pre>
</blockquote>
Interesting, so ./* is a possible operator, but .% is not? That's
good to know.<br>
<blockquote
cite="mid:DA4C1DE1-B00A-4053-9F2E-69A501BC444A@cs.otago.ac.nz"
type="cite">
<pre wrap="">Like Prolog, Mercury allows user-defined operators, so it is not clear
to me how you can build an LL(1) parser unless it can process those
declarations.</pre>
</blockquote>
Yeah, I did know about this from Prolog, but I thought in Mercury
these are more limited, ex. they can have only precedence 120, they
should be between backquotes ("<span style="color: rgb(0, 0, 0);
font-family: 'Times New Roman'; font-size: medium; font-style:
normal; font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: normal; orphans: 2; text-align: -webkit-auto;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px; display: inline !important; float:
none; ">a name, a module qualified name (see<span
class="Apple-converted-space"> </span></span><a
href="http://www.mercury.csse.unimelb.edu.au/information/doc-release/mercury_ref/The-module-system.html#The-module-system"
style="font-family: 'Times New Roman'; font-size: medium;
font-style: normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: normal; orphans: 2;
text-align: -webkit-auto; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">The
module system</a><span style="color: rgb(0, 0, 0); font-family:
'Times New Roman'; font-size: medium; font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing: normal;
line-height: normal; orphans: 2; text-align: -webkit-auto;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px; display: inline !important; float:
none; ">), or a variable between grave accents (backquotes)</span>").
Could you please provide a link to this definition?<br>
Thanks, gabor<br>
<br>
PS.: I still have problems with the precedence 950 fxy parts,
because of the prefix and infix + (-?) operators.<br>
</body>
</html>