[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: representing language for macros



> I think one problem is that Self syntax sucks. (I never saw the point to
> the Smalltalk syntax, and the programming idioms that fall out of it.)
> ScriptX has parse trees, that inherit from collections, so they're as easy
> to use as "append tree leaf" or "tree[1]". A bit different from lisp
> s-expressions, since ScriptX parse trees subclass regular collections and
> add behavior like knowing how to compile into bytecode, and state like
> leafs with name and module references. The parser is a separate object
> that translates byte streams into parse trees, to hide the actual syntax(s)
> of the language from syntaxless parse trees.

There is a very similar set of classes for Smalltalk available from
ParcPlace; in fact, that's how the ParcPlace parser and compiler work.  The
parse node classes probably don't support as much behavior as the ScriptX
ones, but the idea is the same.

I'm sure the idea can be made to work, but it's awkward, and I believe there
are still serious design problems about how to deal with name scoping.  In
particular, do the parse tree classes deal with "textual" names (without
commitment to scoping) or scope-bound names?  If they do the former, then
certain common manipulations on expressions don't work (like in-line
substitution of actual arguments for formal parameters).  If they do the
latter, then certain desirable syntactic extensions don't work (like macros
that take formal parameter names or the names of to-be-locally-scoped
variables as arguments).

All of this has been discussed at great length in the Scheme community, of
course.

						L. Peter Deutsch