<div dir="ltr"><div>I attempted to define a BNF-like description of TDL syntax on the wiki: <a href="http://moin.delph-in.net/TdlRfc">http://moin.delph-in.net/TdlRfc</a></div><div>I tried to follow the partial BNF in the LKB source and often referred to the lisp code itself in order to fill out the rest of the description.<br></div><div><br></div><div>My 3 questions above are concisely repeated at the bottom of the wiki along with some others.</div><div><br></div><div>I welcome corrections and discussion (here or on the wiki) from any TDL nerds or authorities (especially if you&#39;ve written a TDL parser).<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 9, 2018 at 12:49 PM, Michael Wayne Goodman <span dir="ltr">&lt;<a href="mailto:goodmami@uw.edu" target="_blank">goodmami@uw.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi developers,</div><div><br></div><div>I&#39;m taking a closer look at the syntax of TDL files and the situation is a bit of a mess. Can anyone help me clarify some things? (I&#39;ll restrict myself to 3 questions for now)<br></div><div><br></div><div>The Copestake 2002 reference (Implementing TFS Grammars) has a BNF for TDL, but it&#39;s a bit out of date and, according to comments in the LKB source code, incorrect in parts. The LKB source comments are scattered, incomplete, inconsistent, and also a bit outdated. There is not much on the wiki. There is some discussion in the mailing list archives (much from before my time in DELPH-IN), but it&#39;s not clear how current those descriptions are.</div><div><br></div><div>Q1: Are supertypes special in a definition?</div><div><br></div><div>The BNF (in the LKB source) says this:</div><div><br></div><div>    Type-def -&gt; Type { Avm-def | Subtype-def} . | <br>                         Type { Avm-def | Subtype-def}.<br></div><div>    Avm-def -&gt; := Conjunction | Comment Conjunction<br>    Conjunction -&gt; Term { &amp; Term } *<br>    Term -&gt; Type | Feature-term | Diff-list | List | Coreference<br></div><div><br></div><div>That makes it sound like I could do this:</div><div><br></div><div>    mytype := [ FEAT val ] &amp; supertype.</div><div><br></div><div>or even:</div><div><br></div><div>    mytype := &lt;! diff list.. !&gt; &amp; #coref &amp; supertype.</div><div><br></div><div>But elsewhere it seems like a list of parents is special and appears before the rest of the conjunction. E.g., at read-tdl-avm-def of lingo/lkb/src/io-tdl/<wbr>tdltypeinput.lsp I see this alternate definition of Avm-def:<br></div><div><br></div><div>  ;;; Avm-def -&gt; := Parents Conjunction | Parents Comment Conjunction |<br>  ;;;               Parents | Parents Comment<br></div><div><br></div><div>It seems that both ACE and PET are fine with putting supertypes after the feature list (and some other variations). I&#39;m fine with this, but I wonder what it means for docstrings (see Q3 below), which (I think) are supposed to appear after the list of parents and before the feature list.<br></div><div><br></div><div><br></div><div>Q2: Subtype-def is now just a variant of Avm-def, yes?</div><div><br></div><div>The BNF still describes subtyping (with the :&lt; operator) as only taking a single parent:</div><div><br></div><div>    Subtype-def -&gt;  :&lt; type</div><div><br></div><div>But I believe the consensus is that this is unnecessary (it&#39;s equivalent to using := with only a supertype), so :&lt; is treated as equivalent to := (to avoid breaking backward compatibility). Is this interpretation used by all processors?</div><div><br></div><div><br></div><div>Q3: What&#39;s the final word with type comments / docstrings?</div><div><br></div><div>I find evidence of 3 proposed variants: (1) a block of &quot;;&quot; comments before a typename (LTDB-style); (2) a block of &quot;;&quot; comments within a type description; and (3) a &quot;doc string&quot; within a type description. Furthermore, there is a question as to whether comments or strings within a type go after the &quot;:=&quot; or after the list of supertypes. I think #| ... |# comments were not considered for this purpose.</div><div><br></div><div>My guess is this:</div><div><br></div><div>* LTDB-style comments (before the type identifier) are processed separately from TDL-parsing</div><div>* type-internal comments can go anywhere but are discarded</div><div>* type-internal doc strings must appear after the list of supertypes and are later available for inspection (they are included as a non-functional part of a type)</div><div><br></div><div>ACE seems happy with my assumptions, although PET doesn&#39;t seem to like doc strings at all.<br></div><div><br></div><div><br></div><div>Thanks!<span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888"><div><br></div><div>-- <br><div class="m_-3591690003182791182gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Michael Wayne Goodman</div></div></div></div></div></div>
</div></font></span></div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Michael Wayne Goodman</div></div></div></div></div></div>
</div>