Re: Hierarchical query

From: David Cressey <cressey73_at_verizon.net>
Date: Thu, 14 Jun 2007 10:47:55 GMT
Message-ID: <v19ci.12679$Ar5.10209_at_trndny01>


"Jan Hidders" <hidders_at_gmail.com> wrote in message news:1181771087.949362.286440_at_d30g2000prg.googlegroups.com...
> On 13 jun, 22:58, Vadim Tropashko <vadimtro_inva..._at_yahoo.com> wrote:
> > On Jun 13, 9:11 am, Vadim Tropashko <vadimtro_inva..._at_yahoo.com>
> > wrote:
> >
> > > 1 statement_block
> > > 1.1 'declare' (matches token #1)
> > > 1.2 declaration_item_list
> > > 1.2.1 identifier (matches token #2)
> > > 1.2.2 'integer' (matches token #3)
> > > 1.2.3 ';' (matches token #4)
> > > 1.3 'begin' (matches token #5)
> > > 1.4 statements
> > > 1.4.1 assignment
> > > 1.4.1.1 identifier
> > > 1.4.1.2 ':='
> > > 1.4.1.3 number
> > > 1.4.1.4 ';'
> > > 1.4.2 statements (matches empty token)
> > > 1.5 'end';
> >
> > Actually, here is quite simple method. Write down the parse tree as a
> > set of paths, using grammar varibles and constants (terminals and
> > nonterminals) as path elements. In the example above we get:
> >
> > statement_block
> > statement_block.'declare'
> > statement_block.declaration_item_list
> > statement_block.declaration_item_list.identifier"i"
> > statement_block.declaration_item_list.'integer'
> > ... and so on ...
> >
> > Query this set with regular expressions.
> >
> > XML, good bye!
>
> Not so fast. An enumeration of the paths in a tree does not always
> give you enough information to reconstruct the tree, so you would be
> losing expressive power. Never mind that you ignore the order, which
> may be a factor for the scope of declarations.
>

I don't understand why enumerating the paths ignores the order.

> -- Jan Hidders
>
Received on Thu Jun 14 2007 - 12:47:55 CEST

Original text of this message