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

Re: syntax



> Perhaps you can make it regexp-based, using (.*) and \1, etc., to pull
> out bits of lines and glue them together.  Try all the regex
> pattern/replacements in turn, eval'ing the first one that fits.

repeated regular expression substitution sounds good as a first pass
for syntax extension, except that (as we remember from our intro to
compilers classes) regular languages are not powerful enough to detect
matched parentheses-like constructs, so we can't replace the current
rewriting rules with them.

(for any of you that used it, upas, the v8 mailer, did something like
this for mail address rewriting, which was nice in theory, but i've
heard criticisms of it in practice.  i don't know how it dealt with
the multiple layers of () that rfc822 allows.)

unfortunately, the next most powerful notation after regular languages
is context-free grammars, which brings us to the two reasons i don't
think es will have extensible syntax any time soon:

	good syntax for the rewriting rules is hard (it must be as
		powerful as yacc, and probably has to expose the
		grammar as a user-visible data structure)

	we would have to build a yacc-equivalent to recompute
		parsing tables on the fly, as new rules were added.

none of this is impossible, we'll probably do it one of these days,
but i think it's real hard.

anyway, John and Rich, thanks for the suggestions, and i do really
appreciate the concreteness of what you've suggested.

paul