Maintaining a Database of Compiled Grammars

The speech API was written with the assumption that applications, rather than the engine, will store compiled grammars for the following reasons:

· The application can determine when the compiled grammars are no longer needed and can free them.

· The engine doesn't need to store a database.

· The compiled grammar can be transferred to another machine.

It may be preferable for some engines to store compiled grammars, especially if they include user-specific information in the grammar. To store compiled grammars, the engine can maintain a database of grammars. Instead of filling in the native grammar with a representation of the grammar, it can store a handle to the grammar.

When the application eventually passes back the handle of the native grammar, the engine uses the handle to access its database. This handle should be robust enough to be transferred to another machine and recognized as foreign by the engine on the other machine. In addition, the engine should be able to determine whether the handle was deleted because the engine's database was too large.