cgp.translators
Interface Parser

All Known Implementing Classes:
CGIFParser

public interface Parser
extends notio.Parser

Additional functionality to support ANTLR CGIF Parser and June 2001 CG Standard which includes CG Streams. Also, ANTLR requires an InputStream not a Reader, so this interface is generic enough to take input from a file or string, letting the implementation deal with the details of how to read from the supplied source.


Method Summary
 java.lang.String getParseTree()
          Returns a parse tree, if available, as a string.
 void initializeParser(java.io.File f, notio.KnowledgeBase kBase, notio.TranslationContext tContext)
          Initializes the parser to parse the specified character reader.
 void initializeParser(java.lang.String s, notio.KnowledgeBase kBase, notio.TranslationContext tContext)
          Initializes the parser to parse the specified character reader.
 notio.Graph[] parseGraphStream()
          Attempts to parse a graph stream from the input.
 
Methods inherited from interface notio.Parser
getUnitClass, initializeParser, parseActor, parseConcept, parseGraph, parseOutermostContext, parseRelation, parseUnit
 

Method Detail

initializeParser

public void initializeParser(java.io.File f,
                             notio.KnowledgeBase kBase,
                             notio.TranslationContext tContext)
                      throws notio.ParserException
Initializes the parser to parse the specified character reader. Precondition: The file represents a readable CGIF file.
Parameters:
f - the file whose contents are to be parsed.
kBase - the knowledge base to be used while parsing.
tContext - the translation context to be used while parsing.
Throws:
notio.ParserException - if an error occurs while initializing the parser.

initializeParser

public void initializeParser(java.lang.String s,
                             notio.KnowledgeBase kBase,
                             notio.TranslationContext tContext)
                      throws notio.ParserException
Initializes the parser to parse the specified character reader. Precondition: The string represents a readable CGIF file.
Parameters:
s - the string whose contents are to be parsed.
kBase - the knowledge base to be used while parsing.
tContext - the translation context to be used while parsing.
Throws:
notio.ParserException - if an error occurs while initializing the parser.

parseGraphStream

public notio.Graph[] parseGraphStream()
                               throws notio.ParserException
Attempts to parse a graph stream from the input.
Throws:
notio.ParserException - if an error occurs while parsing.
UnimplementedFeatureException - if this parser does not support this parsing method.

getParseTree

public java.lang.String getParseTree()
Returns a parse tree, if available, as a string. This may be empty. This can be useful for diagnostic purposes. Pre-condition: a parser exists and a parsing method has been invoked.
Throws:
UnimplementedFeatureException - if this parser does not support the returning of a parse tree.