Compile Grammar Error Messages and Format

CompileGrammar.exe displays error messages and execution summaries in the console. The tool halts execution and displays an error message when it encounters an error that prevents successful completion of a command. The tool returns EXIT_FAILURE (1) when it encounters an error and returns EXIT_SUCCESS (0) when it completes a command successfully. Whether or not a command completes successfully, the tool displays an execution summary after attempting to process a command.

Compile Grammar validates input files for adherence to SRGS or ARPA formats. Errors are often the result of incorrect structure or syntax in the input file, see Compile Grammar Input and Output File Format. Errors may also be caused by incorrect syntax on the command line when launching the tool, see Compile Grammar Command-Line Syntax.

Compile Grammar will throw an error if it encounters any of the following conditions:

  • The grammar file specified by the /In option cannot be found, or cannot be opened.

  • The grammar file specified by the /In option is not properly formed and cannot be compiled.

  • The /Out option is not specified with a filename.

  • There is no configuration file specified by the /RecoConfig option and there is no default configuration file named "RecoConfig.xml" in the current directory, or in the directory that contains CompileGrammar.exe.

Caution noteCaution

If an existing file has the same name as the file name specified by the /Out option, it will be overwritten. The tool does not warn that a file will be overwritten.

Error messages will have the following format:

<Input file name>(Line number): <Error or Warning> <Error code>: <Error description>

Compile Grammar generates warning and information messages when encounters any of the following conditions while compiling ARPA format source files:

  • The tool finds an entry that is an exact duplicate of another entry in the grammar. The tool ignores the duplicate entry and generates a warning message, for example:

    • contoso.arpa(7130): Warning: Duplicate entry ignored: "The Big"

  • The tool finds a unigram entry that differs from another entry only by letter case, for example "Jack" vs "jack". The tool compiles both entries and emits an information message, for example:

    • contoso.arpa(741): Info: Entry differs from another entry by case: "Jack” (line 741) vs. “jack” (line 120).

      NoteNote

      Information messages may not be emitted for n-grams greater than 1.

Execution summaries will have the following format.

Successful execution:

<CommandName>: <FileName successfully created>

Unsuccessful execution:

<CommandName>: <FileName failed to compile>: <n warnings, n errors>

You must either specify a recognition engine configuration file using the /RecoConfig option, or create a default configuration file named "RecoConfig.xml" in the current directory (the directory for the command line), or in the directory that contains CompileGrammar.exe. The tool will generate an error if you do not supply it with a configuration file.

The following are examples of errors and execution summaries emitted by CompileGrammar:

Example Errors

test.grxml(10): Error: Missing required attribute "xml:lang" for <grammar>

test.arpa(17): Error: Back-off weights must be supplied where required.

Example Execution Summaries

CompileGrammar: 'test.grxml' failed to compile: 0 warnings, 1 errors

CompileGrammar: 'test.arpa' successfully created

Show: