sdr 0.21

net.cscott.sdr.calls.grm
Class Grm

java.lang.Object
  extended by net.cscott.sdr.calls.grm.Grm
Direct Known Subclasses:
Grm.Alt, Grm.Concat, Grm.Mult, Grm.Nonterminal, Grm.Terminal

public abstract class Grm
extends Object

This class contains inner classes creating an AST for the 'natural language' grammar of square dance calls and concepts. This AST is transformed into a Java Speech grammar for the Sphinx speech recognition engine, which then generates text strings. The AST is also transformed into an ANTLR v3 grammar parsing those text strings, which creates Apply trees. The raw rules from the call file need to be processed to remove left recursion and to disambiguate using precedence levels.

Version:
$Id: Grm.java,v 1.3 2006-10-22 15:46:06 cananian Exp $
Author:
C. Scott Ananian

Nested Class Summary
static class Grm.Alt
          Alternation: a|b.
static class Grm.Concat
          Concatanation: a b.
static class Grm.Mult
          Multiplicity marker: a*, a+, or a?.
static class Grm.Nonterminal
          A nonterminal reference to an external rule.
static class Grm.Terminal
          A grammar terminal: a string literal to match.
 
Constructor Summary
Grm()
           
 
Method Summary
abstract
<T> T
accept(GrmVisitor<T> v)
           
static Grm mkGrm(String... terminals)
          Make a Grm which will recognize the given sequence of terminal symbols.
static Grm parse(String rule)
          Parse a string representing a Grm.
abstract  int precedence()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Grm

public Grm()
Method Detail

precedence

public abstract int precedence()

accept

public abstract <T> T accept(GrmVisitor<T> v)

toString

public final String toString()
Overrides:
toString in class Object

mkGrm

public static Grm mkGrm(String... terminals)
Make a Grm which will recognize the given sequence of terminal symbols.


parse

public static Grm parse(String rule)
Parse a string representing a Grm. Parameter references must be numerical.

Throws:
IllegalArgumentException - if the rule is malformed.

sdr 0.21

Copyright (c) 2006 C. Scott Ananian