1997Q4/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: Re: [MUD&#45;Dev] string parsing -->
<!--X-From-R13: "Tryvk O. Qebrf" <sryvkNkf1.fvzcyrk.ay> -->
<!--X-Date: Thu, 30 Oct 1997 18:44:03 +0000 -->
<!--X-Message-Id: 199710301846.TAA27432#xs1,simplex.nl -->
<!--X-Content-Type: text/plain -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, Re: [MUD-Dev] string parsing</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:felix#xs1,simplex.nl">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
      text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">

  <font size="+4" color="#804040">
    <strong><em>MUD-Dev<br>mailing list archive</em></strong>
  </font>
      
<br>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->

Date:&nbsp;
[&nbsp;<a href="msg00176.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00178.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00181.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00180.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00177">Author</A>
&nbsp;|&nbsp;<A HREF="#00177">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00177">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>Re: [MUD-Dev] string parsing</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#null,net">mud-dev#null,net</A></LI>
<LI><em>Subject</em>: Re: [MUD-Dev] string parsing</LI>
<LI><em>From</em>: "Felix A. Croes" &lt;<A HREF="mailto:felix#xs1,simplex.nl">felix#xs1,simplex.nl</A>&gt;</LI>
<LI><em>Date</em>: Thu, 30 Oct 1997 19:46:17 +0100 (MET)</LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
cg#ami-cg,GraySage.Edmonton.AB.CA (Chris Gray) wrote:
&gt; [Felix C:]
&gt;
&gt; :What follows is a description of something I am currently implementing
&gt; :for my server.  I am providing it here for others to comment on.  Also,
&gt; :I'd like to hear of other approaches to the same problem.
&gt;
&gt; In general, I think such a facility is a very good idea. That's why I have
&gt; one in my system! I've found it to be useful in a couple of places, such
&gt; as "sublanguages" for my online building commands, etc.
&gt;
&gt; One of my main concerns, however, is efficiency. LPC isn't as fast as
&gt; native code for string handling, so anything you do on a per-character
&gt; basis is going to be expensive. In my system, I did a number of builtin
&gt; (native) functions to perform most of the core of the work. You can
&gt; probably do that too.

I am writing the entire function as a server builtin, using lazy DFA
construction, lazy DPDA construction, with the appropriate amount of
caching between calls, etc.


&gt;[...]
&gt; Some other issues I've bumped into relating to this kind of parsing:
&gt;[...]
&gt; - the resolution of a noun-phrase string to a MUD-world object can be
&gt;     context dependent on the verb in the command. E.g. 'pick up the rock'
&gt;     can resolve to a different rock than 'take the rock from the sack'.
&gt;     I handle this by not doing the resolution until I am inside the code
&gt;     for the specific verb. Perhaps you could pass the verb to your
&gt;     'find_obj' and 'find_liv' routines, but that doesn't result in very
&gt;     modular verbs.

In this case, `find_obj' should not just deal with "the rock", but with
"the rock from the sack" as a single object.  I.e. it's a matter of
adjusting the grammar.


&gt; My current system is less like your proposal than an earlier one I did.
&gt; I don't quite remember why I changed! I do recall, however, that I ended
&gt; up with a *lot* of rules in the grammar, to handle the various ways that
&gt; the player could give a command. I didn't do the lexical stuff, just the
&gt; syntactic level. The lexical stuff was hard-coded.

Even if you don't remember &lt;why&gt; you changed, do you remember &lt;what&gt; you
changed? :)


&gt; In your last "give sword to dwarf" example, what would parse_string return
&gt; if find_obj couldn't find a sword? An array containing the words of the
&gt; noun-phrase, so that higher-level code could properly complain about not
&gt; being able to find a sword?

My example does not really deal with this possibility at all.  It could
be extended in several ways:
- the function could return such an array, if the object was not found.
- the function could return 0 indicating that this parsing is invalid;
  this could be combined with an additional grammar rule that functions
  as a catch-all for errors in the input.
- assuming that the grammar is unambiguous, the function could deliver
  feedback to the user at parsing time.

Felix Croes

</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<ul compact><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><A NAME="00180" HREF="msg00180.html">Re: [MUD-Dev] string parsing</A></strong>
<ul compact><li><em>From:</em> "Jon A. Lambert" &lt;jlsysinc#ix,netcom.com&gt;</li></ul>
</UL></LI></UL>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00176.html">Re: [MUD-Dev]  string parsing</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00178.html">Re: [MUD-Dev]  string parsing</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00181.html">Skill Listing - Part I</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00180.html">Re: [MUD-Dev] string parsing</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00177"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00177"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><strong><A NAME="00186" HREF="msg00186.html">Poison List - Part I</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Fri 31 Oct 1997, 05:30 GMT
<LI><strong><A NAME="00182" HREF="msg00182.html">Skill Listing - Part II</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Fri 31 Oct 1997, 04:23 GMT
<UL>
<LI><strong><A NAME="00190" HREF="msg00190.html">Re: [MUD-Dev]  Skill Listing - Part II</A></strong>, 
Derrick Jones <a href="mailto:gunther#online1,magnus1.com">gunther#online1,magnus1.com</a>, Fri 31 Oct 1997, 07:23 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00181" HREF="msg00181.html">Skill Listing - Part I</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Fri 31 Oct 1997, 04:20 GMT
<LI><strong><A NAME="00177" HREF="msg00177.html">Re: [MUD-Dev] string parsing</A></strong>, 
Felix A. Croes <a href="mailto:felix#xs1,simplex.nl">felix#xs1,simplex.nl</a>, Thu 30 Oct 1997, 18:44 GMT
<UL>
<LI><strong><A NAME="00180" HREF="msg00180.html">Re: [MUD-Dev] string parsing</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Fri 31 Oct 1997, 01:17 GMT
</LI>
</UL>
<UL>
<li>&lt;Possible follow-up(s)&gt;<br>
<LI><strong><A NAME="00187" HREF="msg00187.html">Re: [MUD-Dev] string parsing</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Fri 31 Oct 1997, 07:02 GMT
</LI>
<LI><strong><A NAME="00192" HREF="msg00192.html">Re: [MUD-Dev] string parsing</A></strong>, 
Felix A. Croes <a href="mailto:felix#xs1,simplex.nl">felix#xs1,simplex.nl</a>, Fri 31 Oct 1997, 12:12 GMT
</LI>
<LI><strong><A NAME="00193" HREF="msg00193.html">Re: [MUD-Dev] string parsing</A></strong>, 
Felix A. Croes <a href="mailto:felix#xs1,simplex.nl">felix#xs1,simplex.nl</a>, Fri 31 Oct 1997, 20:06 GMT
</LI>
</UL>
</LI>
</UL></BLOCKQUOTE>

</ul>
<hr>
<center>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
</center>
<hr>
</body>
</html>