[Home] [By Thread] [By Date] [Recent Entries]


John Cowan <jcowan@r...> wrote:

| Arjun Ray scripsit:

|> I find the while( event ) { switch( type ) { } } structure, which
|> inevitably appears, more than a little clumsy.  
| 
| I don't understand what this control structure has to do with recursive
| descent: I rarely if ever see such a thing.  Can you exemplify?

Not in classic RD, of course.  The pull parser is just the same pattern,
not classic RD.  The while() part emerges in the handling of lists:

  list
   : item
   | item list
   ;

In classic RD list() looks like this

   do_list( ) {
        do_item( ) ;
        if ( next token starts an item )
           do_list( ) ;
   }

which can also be done thusly:

   do_list( ) {
      while ( next token starts an item ) 
        do_item( ) ;
   }

If you insist on the first style, you must be a Schemer at heart. ;-)



Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member