Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Message from discussion Ability to parse a stream?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Clifford Heath  
View profile  
 More options Feb 18 2010, 12:39 am
From: Clifford Heath <clifford.he...@gmail.com>
Date: Thu, 18 Feb 2010 16:39:52 +1100
Local: Thurs, Feb 18 2010 12:39 am
Subject: Re: Ability to parse a stream?
On 18/02/2010, at 3:15 PM, Justin Tulloss wrote:

> My problem is that I want "result" to be the cumulative result of  
> all the different parsing phases. There's a syntax tree generated,  
> and I want it to be built iteratively. Does that make sense? In the  
> example you have above, the "Do something with result" step would be  
> to merge it with all the previous results.

> Is there any way to do something like that? Am I approaching this  
> wrong?

Yes, I think you're approaching it wrongly. The Treetop
syntax tree is much too detailed generally and uses too
much memory.

What we do instead is to add methods to the rules,
which get added to the appropriate nodes, to build
the data structure we want - *after* Treetop has worked
its magic - and then the Treetop tree can be gc'd.

Make these methods recursive, so you can just call e.g.
"value" on the top node, and it builds the whole structure
you need. Don't try to write code to walk the syntax tree
from the outside, as some newbies have tried.

Clifford Heath.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.