grammatica-users
[Top][All Lists]
Advanced

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

[Grammatica-users] Reusing the Parser and Tokenizer classes


From: Luc Morin
Subject: [Grammatica-users] Reusing the Parser and Tokenizer classes
Date: Tue, 13 Jan 2004 13:32:58 -0500

Hello,

I'm using Grammatica in one of my ongoing C# projects, and I'm seeing a 
possible performance issue.

Right now, whenever I need to parse a string and return the "analyzed" result, 
I need to instantiate a new Parser like so (this snippet is taken from my own 
analyzer derived class):


public string GetProperty(String input, int obj) 
{
        string propvalue;

        h_object = obj;
        Parser  parser = new LucParser(new StringReader(input), this);
        parser.Parse();
        
        // call the Eplan 21 API getProperty function to retrieve the actual 
value
        propvalue = getProperty(h_object, propnum, index);
        return propvalue;
}

I'm making a lot of calls to this function, and each time the Parser has to be 
re-initialized, calling its CreatePatterns() function. The Tokenizer also calls 
its own CreatePatterns() function each time. I see this as a performance issue.

Would it be possible to reuse the Parser and Tokenizer classes such that they 
get instantiated only once, and then be able to parse() strings without having 
to re-init ?

This would imply modifying the code templates I guess. Would it involve a lot 
of work from the developers of Grammatica ?

Or maybe this feature is already in there and I just haven't seen it ?

Best regards.


Luc Morin
 
Electrical Designer
Wulftec / M.J. Maillis Group
Ph.: (819) 838-4232 ext. 232
Fx.: (819) 838-5539
 
www.wulftec.com
www.maillis.gr
 
<< Avis de confidentialité >>
Ce courrier électronique ainsi que tous les documents qui y sont attachés sont 
de nature privilégiée et confidentielle et sont destinés à l'utilisation 
exclusive du ou des destinataire(s) ci-haut mentionné(s) . Toute autre personne 
ayant reçu ce message par erreur est priée de bien vouloir s'abstenir de 
divulguer, distribuer ou reproduire ce message et/ou son contenu. Si le 
destinataire ne peut être rejoint ou vous est inconnu, nous vous prions 
d'informer immédiatement l'expéditeur de ce présent message par retour de 
courriel en plus d'effacer ce message et détruire toutes les copies. Merci.
 

<< Confidentiality Notice >>

This e-mail message and any files transmitted with it are confidential, may be 
privileged and are intended for the exclusive use of the addressee(s). Any 
other person is strictly prohibited from disclosing, distributing or 
reproducing it. If the addressee cannot be reached or is unknown to you, please 
inform the sender by return e-mail immediately, delete this e-mail message and 
destroy all copies. Thank you.






reply via email to

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