Monday, July 2, 2001 01:26 AM
> I needed to use an ANTLR generated parser from some registration code, which typically runs before
Pretty hairy construct I must say...
> I used the option codeGenBitsetTestThreshold=999;
> to disable the bitsets, which made the parser safe to run before main()
That works yeah. The bitsetthreshold options are afaik not expected to change.
In the new version a one or two new static members
are generated (int typed so that should not be a problem)
I must say that I'm not very enthusiastic about fixing this.
If it goes on my list of things to fix it will
probably be at the bottom regions.
Of course if you submit a patch that makes this an option
And it does not riddle the code with lots of specialcase
checks, then I'll probably incorporate it.
> I would like a dependable way to build a parser that can be run before main().
Using a C++ parser before main is hairy bussiness,
you might get breakage from the STL (or other sources)
on other platforms/compilers and other
IMHO this solution is built to break.
With some compilers you can find out the
symbols/functions that do these constructions.
Gcc being one (I don't have a direct pointer it would
be on their mailinglists somewhere (or on libstdc++'s).
With help of those you could manually ensure that
stuff is constructed. (but again leads to
You might write a postprocessor for antlr's code
that 'unstatics' stuff. Depending on knowledge of
perl/tcl this might be the fastest fix.