1997Q4/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: Re: [MUD&#45;Dev] string parsing -->
<!--X-From-R13: "Tryvk O. Qebrf" <sryvkNkf1.fvzcyrk.ay> -->
<!--X-Date: Fri, 31 Oct 1997 20:06:43 +0000 -->
<!--X-Message-Id: 199710312006.VAA03804#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="msg00192.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00194.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00192.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00197.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00193">Author</A>
&nbsp;|&nbsp;<A HREF="#00193">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00193">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>: Fri, 31 Oct 1997 21:06:50 +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; :I am writing the entire function as a server builtin, using lazy DFA
&gt; :construction, lazy DPDA construction, with the appropriate amount of
&gt; :caching between calls, etc.
&gt;
&gt; Sorry, I don't grok the acronyms. (I've never been strong on theory, so
&gt; if they refer to something theoretical, I probably wouldn't understand
&gt; an explanation either!)

I explained them in a different posting.  Note that I confused even
myself: no DPDA is actually generated, but rather a shift-reduce
parser that uses parallel LR(0) parsing to simulate a NPDA.  &lt;duck&gt;


&gt; :In this case, `find_obj' should not just deal with "the rock", but with
&gt; :"the rock from the sack" as a single object.  I.e. it's a matter of
&gt; :adjusting the grammar.
&gt;
&gt; You could do that. Sounds a wee bit hackish to me - you'll end up with
&gt; a mess of functions implementing all of the prepositions that you end up
&gt; wanting. At least the functions will know which preposition they are
&gt; dealing with, and can all call common lower-level routines to identify
&gt; the second noun phrase. Hmm. They might have to recursively call
&gt; parse_string to pull out that noun phrase. Gee, I guess that's why I
&gt; have a "ParseNounPhrase" builtin! :-)

Grammar:

    Sentence:	'get' Object
    Sentence:	'get' FromObject
    Sentence:	'examine' Object
    Sentence:	'examine' InObject
    FromObject:	Noun 'from' Noun	? find_obj_in_obj
    InObject:	Noun 'in' Noun		? find_obj_in_obj
    Object:	Noun			? find_obj

with the following function:

    object find_obj_in_obj(mixed *parsetree)
    {
	/*
	 * parsetree = ({ obj1name, preposition, obj2name })
	 *
	 * find obj1 in obj2 (the code below has been simplified)
	 */
	return present(parsetree[0], present(parsetree[2]));
    }

Not actually very hackish, is it?  Finding an object in another object
is a fairly common operation.


&gt; :&gt; My current system is less like your proposal than an earlier one I did.
&gt; :&gt; I don't quite remember why I changed! I do recall, however, that I ended
&gt; :&gt; up with a *lot* of rules in the grammar, to handle the various ways that
&gt; :&gt; the player could give a command. I didn't do the lexical stuff, just the
&gt; :&gt; syntactic level. The lexical stuff was hard-coded.
&gt; :
&gt; :Even if you don't remember &lt;why&gt; you changed, do you remember &lt;what&gt; you
&gt; :changed? :)
&gt;
&gt; Urgh. Lemme go look - the old stuff is around here somewhere... ... found!
&gt; Its off in my "CPM" directory, which is stuff I saved from my CP/M machine
&gt; before I threw it away - that tells you how old it is! Anyway, it was
&gt; somewhat simpler than what you are planning - there was no structure to
&gt; grammar - each input form was flat, e.g. (from the docs):
&gt;
&gt;     give [ARTICLE] ADJECTIVE* NOUN to [ARTICLE] ADJECTIVE* NOUN [PUNCTUATION]

It looks as if your system used regular expressions, rather than a
context-free grammar (a context-free grammar is just a set of
production rules as in the example above).  The latter is much more
powerful.  There is a great deal that you can find out merely by
checking the syntax, which cuts down on the need for function calls
that you mentioned.

What is your new system like?

Felix Croes

</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00192.html">Re: [MUD-Dev] string parsing</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00194.html">Re: [MUD-Dev] string parsing</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00192.html">Re: [MUD-Dev] string parsing</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00197.html">Re: [MUD-Dev] string parsing</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00193"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00193"><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="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>
<LI><strong><A NAME="00197" HREF="msg00197.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>, Sat 01 Nov 1997, 18:17 GMT
</LI>
<LI><strong><A NAME="00198" HREF="msg00198.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>, Sat 01 Nov 1997, 20:17 GMT
</LI>
<LI><strong><A NAME="00228" HREF="msg00228.html">Re: [MUD-Dev] string parsing</A></strong>, 
Felix A. Croes <a href="mailto:felix#xs1,simplex.nl">felix#xs1,simplex.nl</a>, Mon 03 Nov 1997, 13:25 GMT
<UL>
<LI><strong><A NAME="00231" HREF="msg00231.html">Re: [MUD-Dev] string parsing</A></strong>, 
coder <a href="mailto:coder#ibm,net">coder#ibm,net</a>, Tue 04 Nov 1997, 04:30 GMT
</LI>
</UL>
</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>