Nuance GSL grammars can be translated to the ABNF syntax using NuGram IDE.
However, semantic action tags
are not translated to SISR. They remain in the GSL tag format (specified as Nuance in the
ABNF tag-format header).
GSL grammars can be converted one at a time or in batch.
To convert a single GSL grammar to ABNF, select the resource in the Navigator view, open the contextual menu by right-clicking on the resource, and select Grammar Tools > Convert To ABNF:
An ABNF grammar with the same name as the GSL grammar, but with the extension .abnf,
is created in the same folder.
The GSL grammar must have the extension .grammar or .gsl.
All GSL grammars in a folder and its subfolders can be translated to ABNF at once. To do that, simply select the folder in the Navigator view, open the contextual menu by right-clicking on the folder, and select Grammar Tools > Convert All GSL Grammars To ABNF:
GSL grammar files can include other grammar files. The GSL importer properly handles included files
and produces meta headers in the ABNF grammar that are processed by the GSL exporter/builder
to properly recreate the original GSL file with all its included grammars. The generated headers are:
meta "gsl_include_file" is "original_gsl_include.gsl"; meta "gsl_referenced_include_file" is "referenced_file.abnf"; To illustrate this, consider the following GSL grammar:
;GSL2.0 #include "file_a.gsl" Root (SomeGrammar SomeOtherGrammar)
And suppose also that file_a.gsl includes file_b.gsl, SomeGrammar
is defined in file_a.gsl, and SomeOtherGrammar is defined in file_b.gsl.
The resulting ABNF grammar looks like:
#ABNF 1.0 ISO-8859-1;
language fr-CA;
mode voice;
tag-format <Nuance>;
meta "gsl_include_file" is "file_a.gsl";
meta "gsl_referenced_include_file" is "file_b.abnf";
meta "gsl_referenced_include_file" is "file_a.abnf";
root $Root;
private $Root =
$<file_a.abnf#SomeGrammar> $<file_b.abnf#SomeOtherGrammar>
;
The first meta indicates that file_a.gsl was directly included by the GSL grammar file,
while the two others indicate that there are rule references in the ABNF grammar that were produced
as the result of processing the inclusion chain.
When converting a GSL grammar to ABNF, the following transformations are applied:
| The expansion | is translated to |
|---|---|
<special:passthrough> |
$NULL |
<special:NULL> |
$NULL |
<special:roadblock> |
$VOID |
<special:VOID> |
$VOID |
<local:Rulename> |
$Rulename |
The GSL importer tries to be as compliant as possible with the GSL syntax described in the Nuance 8.5 Grammar Developer's Guide. However, some GSL features have no equivalent in ABNF. These features are:
< <URI_1> % <backoff_URI> >< <Grammar_File_URI> ! RuleName = <New_URI> & ... >