[antlr-interest] we can do push/pop error stuff for 4%
Olivier Dragon
dragonoe at mcmaster.ca
Sat May 27 14:31:37 PDT 2006
On Sat, May 27, 2006 at 12:51:29PM -0700, Terence Parr wrote:
>
> On May 27, 2006, at 12:44 PM, Sohail Somani wrote:
> >Aren't java containers thread safe or something? Might be
> >synchronize(this) or something like that...
>
> Good point, though I thought that synchronization had gotten much
> faster these days...
I think it might also have to do with fact that java.util.Stack is
based on Vector, which is a resizeable array with default size 10. If
your grammar uses more than 10 elements it's going to do a lot of
resizing.
If you're interested in seeing the possible effect of either
synchronisation or resizing, build a stack class using
java.util.ArrayList which is resizeable but not synchronised. I presume
you build your stack with a fixed size array?
Do you know ahead of time the maximum size of the Stack based on the
grammar?
-Olivier
--
__-/| ? ? |\-__
__--/ / \ (^^) / \ \--__
_-/ / / /\ / ( ) /\ \ \ \-_
/ / / / / ( ^^ ~ \ \ \ \ \
/ Oli Dragon ( dragonoe at mcmaster.ca \
/ B.Eng. Sfwr ( dragon.homelinux.org \
/ / / /__--_ ( ) __--__\ \ \ \
| / / _/ \_ \_ \_ \ \ |
\/ / _/ \_ \_ \_ \ \/
\_/ / -\_\ \ \_/
\/ ) \/
*~
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20060527/f777dfe6/attachment.bin
More information about the antlr-interest
mailing list