phone_number.gram

#ABNF 1.0;
mode voice;
language en-US;
tag-format <lumenvox/1.0>; // The lumenvox tag format tracks the current working draft of
                        // the W3Cs semantic interpretation proposal.
                        // 1.0 corresponds to the working draft released on 01 April 2003

root $PhoneNumber;

/* ONE:"1" is shorthand for
* ONE {!{ $="1" }!}
* "$" refers to the current rule being matched ($Digit)
* So the net effect is that $Digit resolves to a one digit string
* after semantic interpretation.
*/

$Digit = (ONE:"1"        |
        TWO:"2"        |

          THREE:"3"      |

          FOUR:"4"       |

          FIVE:"5"       |

          SIX:"6"        |

          SEVEN:"7"      |

          EIGHT:"8"      |

          NINE:"9"       |

          (ZERO | O):"0" );

 

/* $AreaCode resolves to a three digit string

 * after semantic interpretation.

 */

$AreaCode = { $ = "" } ( $Digit { $ += $Digit } ) <3>;

 

/* $Number resolves to a seven digit string

 * after semantic interpretation.

 */

$Number = { $ = "" } ( $Digit { $ += $$ } ) <7>;   //$$ is shorthand for the last rule detected

                                                   //i.e. $Digit

 

/* After semantic interpretation,

 * $PhoneNumber resolves to a structure with two member variable strings,

 * areacode (which defaults to "858"), and number.

 */

$PhoneNumber = ([AREA CODE | ONE] $AreaCode { $.areacode = $$ }   $Number { $.number = $$ } ) |

               ( $Number ) { $.areacode = "858"; $.number = $$ };

 


Complete Help Topic List | Speech Engine Product Information