[antlr-interest] ITLS (was: Translators Should Use Tree Grammars)

John D. Mitchell johnm-antlr at non.net
Sat Nov 20 23:16:41 PST 2004


>>>>> "atripp54321" == atripp54321  <atripp at comcast.net> writes:
[...]

> I don't address the Visitor pattern, and I haven't even finished reading
> your page and the posted responses. I just thought I'd get my early,
> uninformed thoughts down on paper first.  Wouldn't want to let
> well-argued points that you gurus make make get in my way of opinions :)

Good to write down your ideas before getting tainted by the rest of us but
you might want to hold off on "publishing" until after you have read and
digested the existing state of practice. :-( :-)


> Here's my 8-page-or-so furiously written diatribe against treewalkers:
> http://jazillian.com/antlr/trees.html

Well, I don't have time to get into all of the silliness (and other folks
have already done a fair job at it :-) so here's a more general facet that,
alas, is missed completely in your diatribe...


"Programming" is about the creation and transformation of relationships.
That process is mediated by the creation and manipulation of "languages".
I don't care if you call the language a "language" or "protocol" or "API"
or "idiom" or "pattern" or "design" or "framework" or "architecture" or
"paradigm" or etc. (ad nauseum).

One sad fact in the software world is that coders literally get lost in the
"code" and forget all about the fact that they are dealing with
languages. [And please do note carefullly that I wrote "languages",
plural.]

Another sad fact is that most programming language "designers" have fallen
victim to the same problem as the rest and their programming languages are
"designed" (almost uniformly horribly, I must say) for people to write more
incomprehensible "code" rather than languages.


Much of the perennial arguments around visitors vs. tree walkers (and the
attendant homogeneous vs. heterogeneous node typing) is rooted [sorry :-)]
in this fallacy that visitors are somehow intrinsically better because the
programmer has to do all of the work for themselves (which, even if not
explicit, really means that the programmer has all of the freedom that they
want to 'break the rules' and do whatever hacks they want [this is a clear
manifestation, in programmers, of the addiction to the belief of control]).


The crucial fact is that grammars are the best tool that we have to
articulate languages precisely because their focus is the grammar of the
language (which is a combination of lexical; syntactic; and denotational,
situational, and (ultimately) connotational semantics).

Hand-written approaches (to non-grammar-based solutions) are doomed to
hiding and obscuring the fundamental facets of the language as the
"grammar" of the language is dispersed throughout the implementation
details which are expressed through a "general purpose programming
language" (e.g., Java, C, OCaml, etc.)


So, let me end with two (hopefully at least slightly humorous) variations
of a couple of old saws:

	* It's the language, stupid!

	* Any non-trivial program written in a general purpose programming
          language contains ad-hoc, bug-ridden, inarticulate
          implementations of multiple, informally-specified, incomplete
          languages.

Take care,
	John


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the antlr-interest mailing list