<!-- MHonArc v2.4.4 -->
<!--X-Subject: Re: [MUD-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>
[ <a href="../">Other Periods</a>
| <a href="../../">Other mailing lists</a>
| <a href="/search.php3">Search</a>
]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->
Date:
[ <a href="msg00176.html">Previous</a>
| <a href="msg00178.html">Next</a>
]
Thread:
[ <a href="msg00181.html">Previous</a>
| <a href="msg00180.html">Next</a>
]
Index:
[ <A HREF="author.html#00177">Author</A>
| <A HREF="#00177">Date</A>
| <A HREF="thread.html#00177">Thread</A>
]
<!--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" <<A HREF="mailto:felix#xs1,simplex.nl">felix#xs1,simplex.nl</A>></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:
> [Felix C:]
>
> :What follows is a description of something I am currently implementing
> :for my server. I am providing it here for others to comment on. Also,
> :I'd like to hear of other approaches to the same problem.
>
> In general, I think such a facility is a very good idea. That's why I have
> one in my system! I've found it to be useful in a couple of places, such
> as "sublanguages" for my online building commands, etc.
>
> One of my main concerns, however, is efficiency. LPC isn't as fast as
> native code for string handling, so anything you do on a per-character
> basis is going to be expensive. In my system, I did a number of builtin
> (native) functions to perform most of the core of the work. You can
> 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.
>[...]
> Some other issues I've bumped into relating to this kind of parsing:
>[...]
> - the resolution of a noun-phrase string to a MUD-world object can be
> context dependent on the verb in the command. E.g. 'pick up the rock'
> can resolve to a different rock than 'take the rock from the sack'.
> I handle this by not doing the resolution until I am inside the code
> for the specific verb. Perhaps you could pass the verb to your
> 'find_obj' and 'find_liv' routines, but that doesn't result in very
> 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.
> My current system is less like your proposal than an earlier one I did.
> I don't quite remember why I changed! I do recall, however, that I ended
> up with a *lot* of rules in the grammar, to handle the various ways that
> the player could give a command. I didn't do the lexical stuff, just the
> syntactic level. The lexical stuff was hard-coded.
Even if you don't remember <why> you changed, do you remember <what> you
changed? :)
> In your last "give sword to dwarf" example, what would parse_string return
> if find_obj couldn't find a sword? An array containing the words of the
> noun-phrase, so that higher-level code could properly complain about not
> 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" <jlsysinc#ix,netcom.com></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><Possible follow-up(s)><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>
[ <a href="../">Other Periods</a>
| <a href="../../">Other mailing lists</a>
| <a href="/search.php3">Search</a>
]
</center>
<hr>
</body>
</html>