[antlr-interest] Re: Is ANTRLR Thread safe

meilland78 jean-claude.meilland at experian-scorex.com
Thu May 27 06:38:46 PDT 2004


Ok thanks for the reply.
Well I guess I can just create a lexer and parser for each thread so 
I'm sure I wont have any problems. Shouldnt use to much memory.

Cheers,

J.Claude.

--- In antlr-interest at yahoogroups.com, Ric Klaren <klaren at c...> wrote:
> On Thu, May 27, 2004 at 09:53:38AM -0000, meilland78 wrote:
> > Sorry forgot to specify it : C++ language.
> 
> The C++ support lib is not thread safe per se. Although if you take 
care
> you can probably get away with a lot. I suggest lots of (generated) 
source
> reading.
> 
> If you can keep the whole lexer/parser/treeparser chain in one 
thread you
> can have multiple instances of that thread going (e.g. parse 
multiple files
> concurrently).
> 
> The AST/Token classes do not support concurrent (rw) access 
(although I've
> seen report in the past that it was possible to fix the reference 
counters
> for it but that was *way* back). Again you might get away with some
> concurrent readonly access. But it's probably best to modify the 
reference
> counter classes to make them thread safe. (there was a post on this
> somewhere in the archive but the yahoogroups search seems to have 
hit an
> alltime low in finding stuff)
> 
> Problems might come from the ASTNULLType instance there should be 
only one
> instance of it between threads accessing the same AST. You might 
have to
> fiddle it a bit for concurrent access.
> 
> Cheers,
> 
> Ric
> --
> -----
+++++*****************************************************+++++++++---
----
>     ---- Ric Klaren ----- j.klaren at u... ----- +31 53 4893755  ----
> -----
+++++*****************************************************+++++++++---
----
>   "I don't have anything against Java - it's the best damn 
implementation
>               of UCSD Pascal ever released..." --- Larry Smith



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list