Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> comp.databases.theory -> Re: RM and abstract syntax trees
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 Wed Oct 31 2007 - 19:29:47 CDT