Newsgroups: rec.arts.int-fiction
Path: gmd.de!xlink.net!rz.uni-karlsruhe.de!news.uni-stuttgart.de!news.belwue.de!zib-berlin.de!netmbx.de!Germany.EU.net!EU.net!howland.reston.ans.net!usenet.ins.cwru.edu!nigel.msen.com!yale.edu!noc.near.net!transfer.stratus.com!jjmhome!schunix!sonix
From: sonix@schunix.dmc.com (Duane Morin)
Subject: Parsers
Message-ID: <1994Mar1.140641.23498@schunix.dmc.com>
Organization: SCHUNIX Public Access Unix for Worcester County, MA, USA
Date: Tue, 1 Mar 94 14:06:41 GMT
Lines: 59

I like parsers.  I think they're the most fun part of writing  the game.
As a matter of fact, probably the only reason I follow IF is because its
one of the few places left in the world that appreciates natural language.

But, anyway.  I'm wondering what people like in a parser, and whether or not
ANY parser would be "good enough"?  That is, won't you be able to find 
things that just won't work, regardless of how good the parser is?

Sometimes, ambiguity sets in.  Where it doesn't, things should be easy.
I mean:

>plant pot plant in plant pot    // Or SOMETHING like that

Should be easy, because it's essentially unambiguous:

plant ::= <COMMAND> | <ADJ> | NOUN
pot   ::= <ADJ> | <NOUN>
in    ::= <PREP>

<VERB_PHRASE> ::= <COMMAND> <OBJECT> <PREP> <OBJECT>
<OBJECT>      ::= <ADJ> <NOUN>  | <NOUN>

However, how about something like this:

You enter a room.  There is a chest on the floor, and one on a table.

>examine chest on floor

You find a picture.

>put picture in chest on table

Now, this is ambiguous.  Is it "picture in chest" or is it "chest on table"?
Granted, a typical parser would take it as the second meaning, because
you don't have to describe the picture as being in the chest.  But,
say there was another picture, hanging on the wall?  If <OBJECT> is
defined as something like this:

OBJECT ::= <NOUN> | <ADJ> <NOUN> | <OBJECT> <RELATION> <OBJECT>
RELATION ::= in | on | under 

Then there's a problem.  Parser would have to assume that you meant
"picture in chest", because that fits.  Heck, I just realized that if I
had this:

>examine chest on table
You find a picture.

>examine picture in chest on table

Then that works, too. :)  I suppose we'd have to have something in there
to verify whether or not the case of <OBJECT><RELATION><OBJECT> was an
appropriate description, to help knock out some ambiguity.

Back to the original idea.  I'm not familiar with IF parser technology
very much.  Does your standard parser handle things like the above
examples?  If not, should it?  If so, what wouldn't it handle?

Duane, writing a parser, if no one had guessed
