Closed AndyPook closed 7 years ago
Hi @AndyPook, yes it should be thread safe. Some of the grammars in eto (e.g. EbnfGrammar, GoldGrammar, etc) are not thread safe but could be made to be.
Thanks. Probably wouldn't be worth the effort as they would probably only be required to bootstrap the singleton.
Exactly (;
One thing I forgot though, is that upon first use of a grammar, it goes through an initialization phase to optimize and fix left recursive grammars, etc. This is not thread safe as it updates the grammar structure. You can do this manually by calling Grammar.Initialize() after construction, and all should be good.
Just looking for confirmation... It is possible to create a Grammar as a singleton then have many threads concurrently parsing many strings? (This is the purpose of ParseArgs)