Re: Headfirst Again
From: | Ed Heil <edh@...> |
Date: | Monday, May 8, 2000, 4:19 |
Effective, but unfortunately the sort of thing I was hoping to avoid
-- effectively, the withs and endwiths become parentheses. I think I
may prefer to avoid ambiguity for a few levels, and just live with the
fact that after a certain depth the langauge becomes ambiguous.
On Sun, May 07, 2000 at 05:47:33PM +0530, LIJESH KRISHNAN wrote:
> > Let's try this again.
> >
> > The grammar of HeadFirst now goes like this:
> >
> > S => HP
> >
> > HP => H [ W M [ W M [ W M.....]]]
> >
> > W => | with |
> > | and-with |
> > | also-with |
> >
> > M => [as-[inverse]-HP] HP
>
> > "also-with" is not a perfect means for avoiding ambiguity,
> > but it will hopefully do for now.
> >
>
> I'm not sure the ambiguity is resolved. With with, and-with and also-with,
> you have the ability to relate only to the previous level and the two levels
> above it.
> eg. A guy with a dog who has a collar with a tag tied on it. The guy also
> has a newspaper.
>
> guy with dog with collar with tag ******** newspaper.
>
> You need the ability to deal with an unknown depth of recursion. I don't
> think this is possible with a regular grammar. You will probably need a
> context-free grammar, using delimiters like endwith or simply end.
> So a grammar could be
>
> [S] -> [HP]
> [HP] - > [H][C]
> [C] -> with [M] endwith[C] |
> | null
> [M] -> [HP]
> | as-[HP][HP]
> | as-inverse-[HP][HP]
>
> I don't know what the relations are so I've just put HP.
> And within the with-endwith block you can relate objects at the same level.
>
> [S] -> [HP]
> [HP] - > [H][C]
> [C] -> with [M] endwith[C] |
> | null
> [M] -> [HP][M]
> | as-[HP][HP][M]
> | as-inverse-[HP][HP][M]
> | null
>
> so the guy with a dog with a tagged collar and fleas, with the guy holding a
> headlined newspaper would be
>
> guy with dog with collar with tag endwith fleas endwith newspaper with
> headline endwith endwith
>
> "In the beginning, God created the heavens and the earth."
>
> God with as-inverse-agent creation with as-time beginning as-patient heavens
> as-patient earth endwith endwith
> or
> creation with as-agent God as-time beginning as-patient heavens as-patient
> earth endwith
>
> "And the earth was without form, and void, and darkness moved over
> the face of the deep"
>
> earth with as-form nothing as-characteristic void endwith
> darkness with as-inverse-agent motion with as-location face with
> as-inverse-possession deep endwith endwith endwith
>
> Tell me what you think about it.
> Lijesh