<div dir="ltr"><div style="font-family:arial,helvetica,sans-serif" class="gmail_default"></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Hello developers,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">It&#39;s been a while but I&#39;m returning to a discussion we were having about serializing EDS in the native format when there is no TOP and when there&#39;s no INDEX to backoff to. Stephan suggested that EDS is a line-based format (i.e., line breaks are required), while I would like to continue to support single-line EDS in PyDelphin. I think the last word on the subject from Stephan, at least on this list, was mid-September (<a href="http://lists.delph-in.net/archives/developers/2020/003140.html">http://lists.delph-in.net/archives/developers/2020/003140.html</a>), where he said he&#39;d continue discussion on another thread, which presumably meant the thread from late August (<a href="http://lists.delph-in.net/archives/developers/2020/003127.html">http://lists.delph-in.net/archives/developers/2020/003127.html</a>). I don&#39;t think the discussion did continue, so I&#39;m starting this thread in case anyone is interested.<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">As an example, here&#39;s an EDS (without properties) for &quot;It rained.&quot;</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">    {e2:<br>     e2:_rain_v_1&lt;3:9&gt;[]<br>    }<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">In PyDelphin, when an EDS has no TOP, I was outputting the first colon anyway, intentionally:</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">    {:<br>     e2:_rain_v_1&lt;3:9&gt;[]<br>    }</div></div><div><br></div><div><div style="font-family:arial,helvetica,sans-serif" class="gmail_default">It&#39;s a bit ugly, but it allows me to detect, with 1 token of lookahead, if there&#39;s a top or not. If the colon is omitted then it&#39;s not clear if &quot;e2:&quot; is the top or the start of the first node. If line breaks are required, we just assume the first line is for the top, whether or not it&#39;s there. But for single-line EDS, we need 4 tokens of lookahead to determine if there&#39;s a top (assuming the parser treats variables and predicates as the same kinds of tokens):<br></div><div style="font-family:arial,helvetica,sans-serif" class="gmail_default"><br></div><div style="font-family:arial,helvetica,sans-serif" class="gmail_default"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">    {e2: e2:_rain_v_1&lt;3:9&gt;[]}<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">    {e2:_rain_v_1&lt;3:9&gt;[]}</div></div></div></div><div><br></div><div><div style="font-family:arial,helvetica,sans-serif" class="gmail_default">Here is the parsing algorithm, once we&#39;ve consumed the first &#39;{&#39;:</div><div style="font-family:arial,helvetica,sans-serif" class="gmail_default"><br></div><div style="font-family:arial,helvetica,sans-serif" class="gmail_default">1. If the 1st lookahead token is &#39;:&#39;, &#39;(fragmented)&#39; (or another graph status), &#39;}&#39;, or &#39;|&#39; (node status), then we know that TOP is missing (the &#39;:&#39; is for PyDelphin&#39;s current output)</div><div style="font-family:arial,helvetica,sans-serif" class="gmail_default">2. Otherwise the 1st and 2nd tokens must be a symbol and a colon, and if the 3rd token is a graph or node status, OR if the 4th token is &#39;:&#39;, then the 1st token is the TOP</div><div style="font-family:arial,helvetica,sans-serif" class="gmail_default">3. Otherwise TOP must be missing<br></div></div><div><br></div><div><div style="font-family:arial,helvetica,sans-serif" class="gmail_default">I think this covers all the cases but let me know if I&#39;ve missed anything.</div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">-Michael Wayne Goodman</div></div>