Message-ID: <3D2EC10C.4070802@csi.com>
Date: Fri, 12 Jul 2002 07:44:12 -0400
From: John Colagioia <JColagioia@csi.com>
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0rc2) Gecko/20020618 Netscape/7.0b1
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: rec.arts.int-fiction
Subject: Re: Non-Imperative Parsing (was Re: Another worm for the NLP can...)
References: <Xns924645FEF5002joaomendesnetcabopt@194.65.14.150> <3d2ae2a2@excalibur.gbmtech.net> <Xns924861C153DDFjoaomendesnetcabopt@194.65.14.150> <3d2d7f33$1@excalibur.gbmtech.net> <u1yaaz5nb.fsf@FWILSON.i-did-not-set--mail-host-address--so-shoot-me>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: ool-182f30fa.dyn.optonline.net
X-Original-NNTP-Posting-Host: ool-182f30fa.dyn.optonline.net
X-Trace: excalibur.gbmtech.net 1026473840 ool-182f30fa.dyn.optonline.net (12 Jul 2002 07:37:20 -0400)
Organization: ProNet USA Inc.
Lines: 33
X-Authenticated-User: jnc
Path: news.duke.edu!newsgate.duke.edu!nntp-out.monmouth.com!newspeer.monmouth.com!news-out.visi.com!hermes.visi.com!nntp5.savvis.net!uunet!dfw.uu.net!ash.uu.net!excalibur.gbmtech.net
Xref: news.duke.edu rec.arts.int-fiction:106075

Fraser Wilson wrote:
> "John Colagioia" <JColagioia@csi.com> writes:
>>Actually, has anybody done any object-oriented parsing?  I
>>read an article not too long ago describing it as being
>>fairly nice, but didn't provide any useful implementation
>>details.
> Yes.  I've found it useful for highly structured grammars
> (e.g. programming languages, particularly from the Algol family).  If
> you have an EBNF, then you can pretty directly map named rules to
> classes, and choice-only rules map to inheritence.  E.g. a Statement
> rule maps to a Statement class, and an If-statement maps to an
> If_Statement_Class, because it's one of the choices for the statement
> rule.

Any chance you could give me a quick example?  I found some supposed
example code, but it was less than enlightening (and what I could
understand looked extremely clunky and inefficient).

> This sort of thing makes semantic analysis and code generation quite neat.

It sounds like it should be useful.

> I can't imagine that the limited IF grammar is particularly amenable
> to this sort of thing though.  However, there's more than likely
> another way to apply it that I haven't thought of.

I'm thinking that the interest with respect to IF wouldn't so much be
in parsing "give the blue toy to the cat," but in allowing authors to
"patch in" experimental grammar additions like some that are being
discussed.

That, of course, depends on how it all actually works, though...

