grammatica-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Grammatica-users] Question about grammatica


From: MANSION, James, FM
Subject: [Grammatica-users] Question about grammatica
Date: Tue, 23 Nov 2004 16:49:22 -0000

Hi
 
First, apologies about the standard mail gateway added stuff at the bottom.  I can't turn it off. :-(
 
Now - I'm trying to use grammatica analysis in two phases.  I'm using the Java API, version 1.4.
 
In the first, the value I return at values(0) is a type code, which I use in a sematic analysis pass.
Then, I perform an interpretive pass (and actually, I may repeat this) in which I evaluate my parse tree having set up mappings for 'external' data.
 
One of the side effects of my semantic analysis is that I save node references away for various bits of the parse tree, and for literal values I save them in a HashMap which is keyed by the Node.
 
I find that unfortunately the rewriting of the Production tree in an analyzer works against me because of coutrse the hashCode changes as a result of the tree rebuild.  In my case I can work around this because in practice I always have a terminal Token against which I can key the result.
 
When I found that exitProd returned a Node, I had assumed that if I wanted to do rewriting and restructuring, then that is where I would do it, and that rather than visit re-adding children, the driver would replace the children in-place in the child vector and then compress-out any nulls.  I would hope that a 'null' analysis for an interpreter pass would not perform any tree rewriting but would just visit nodes. :-(
 
I'n in two minds whether to attempt this, or have another method similar to analyze(Node,ParserLogException) that just visits the structure, without implicitly clearing values from any nodes, and ignoring returned Node references so that the structure is unchanged.
 
How do others handle this?

James Mansion

+44 20 7648 3972

 

 


***********************************************************************************
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB.
Authorised and regulated by the Financial Services Authority

This e-mail message is confidential and for use by the
addressee only. If the message is received by anyone other
than the addressee, please return the message to the sender
by replying to it and then delete the message from your
computer. Internet e-mails are not necessarily secure. The
Royal Bank of Scotland plc does not accept responsibility for
changes made to this message after it was sent.

Whilst all reasonable care has been taken to avoid the
transmission of viruses, it is the responsibility of the recipient to
ensure that the onward transmission, opening or use of this
message and any attachments will not adversely affect its
systems or data. No responsibility is accepted by The Royal
Bank of Scotland plc in this regard and the recipient should carry
out such virus and other checks as it considers appropriate.
Visit our websites at:
http://www.rbs.co.uk/CBFM
http://www.rbsmarkets.com
********************************************************************************

reply via email to

[Prev in Thread] Current Thread [Next in Thread]