Syntax & Sematics [was: Re: [Enough already] Re: Proposal3: Make $_ ..]

Mats Nygren nygren at sics.se
Sat Jun 3 17:54:06 UTC 2000


danielv at netvision.net.il wrote:
> 
> > I sincerely hope that at least some of the people on this list will take
> > an interest in this line of development.
> > 
> > /Mats Nygren
> 
> This one certainly will. I'm wondering what sort of tools you intend to
> develop for acting on the parse trees. Tools to generate and calculate
> attribute grammars and such would be very useful.
> 
> Daniel

Thanks for the interest. I have to disappoint you, a havent produced any
hot new tools, only a particular framework which I will describe and
motivate, and some particular code that is useful. (And some simple parsing tools
I admit). At the present I find promoting this idea more important than producing
smart tools. They will arise when needed.

BTW I did some (simple) tools earlier. It can be
reincarnated in Squeak. The main point making them different from lex/yacc
is that a tool should produce both a writer and a reader for its syntax.
In this way an ever growing opportunity for connecting things arises.
Quite different from a lot of computing practice. In more detail, a parsing
tool should produce a bijective mapping from a set of tree's to a set of strings
(or other sequences).
The Scanner/Unscanner worked quite well. The parse/deparse tool neede more work.
I guess in connection with TGen something powerful could be written that goes both
ways.

Of course the well known Visitor pattern is useful for doing things with
parse-trees. The Visitor when seen like this becomes the structure homomorphism
or the elimination rule of the parse-tree type. Or rather a family of such with
different traversal strategies.

And Prolog is good for juggling with trees. And functional programming
(which is close to the Visitor pattern in this case).

I think that when the syntax-material is reincarnated in Squeak it will
be a class hierarchy where languages will inherit structure from similar
languages. Making it real easy to try out some new stuff as long as it
it similar to something existing. In a way this is an answer to the tools question,
use inheritance! My experience with this from outside Squeak with specialpurpose
inheritance mechanisms is quite encouraging. Very often there is a family of
related languages, this is handled quite well.

/Mats





More information about the Squeak-dev mailing list