Re: RM and abstract syntax trees

From: David BL <davidbl_at_iinet.net.au>
Date: Wed, 31 Oct 2007 17:29:47 -0700
Message-ID: <1193876987.569808.5180_at_e34g2000pro.googlegroups.com>


[Quoted] On Nov 1, 7:23 am, Tegiri Nenashi <TegiriNena..._at_gmail.com> wrote:
> On Oct 29, 7:06 pm, David BL <davi..._at_iinet.net.au> wrote:
>
> > The inappropriateness of the RM for ASTs is highlighted when we
> > interpret tuples as propositions or facts. Consider the following
> > expression
>
> > (x + 1) * 3
>
> > In order to state the fact that this expression consists of the
> > product of subexpressions '(x+1)' and '3', one must clearly assign
> > names to the things about which we want to state facts. No wonder the
> > RM forces us to go on a naming spree.
>
> And when you consider the above expression in the language theory you
> don't assign grammar symbols to each subexpression? In your example
> they clearly are:
>
> number : 1 | 3;
> expr : number | expr + expr | expr * expr | ( expr );

I don't understand your point. Naming grammar symbols is quite different from naming actual instances of subexpressions. Imagine how many names one would need in a large source code program.

> > By contrast, in LISP we may directly represent the above expression
> > using the following S-expression
>
> > (* (+ x 1) 3)
>
> So? What power Lisp gives you in the realm of languages and grammars?

I don't understand you. My point is that Lisp doesn't expect you to name the subexpressions because the underlying implementation allocates cons cells and use pointers to represent the structure.

[snip] Received on Thu Nov 01 2007 - 01:29:47 CET

Original text of this message