com.inxar.syntacs.translator.syntacs
Class SyntacsInterpreter

java.lang.Object
  |
  +--com.inxar.syntacs.translator.lr.AbstractLRTranslationComponent
        |
        +--com.inxar.syntacs.translator.lr.StandardLRTranslatorInterpreter
              |
              +--com.inxar.syntacs.translator.syntacs.SyntacsInterpreter
All Implemented Interfaces:
LexerInterpreter, LRTranslationComponent, LRTranslatorInterpreter, ParserInterpreter

public class SyntacsInterpreter
extends StandardLRTranslatorInterpreter

Interpreter used in the translation of newtacs grammar files (.stt).


Constructor Summary
SyntacsInterpreter()
           
 
Method Summary
 Object getResult()
          When translation is complete and there were no unrecoverable errors, the LRTranslatorInterpreter should be able to produce some Object which was built from the parse tree.
 void match(int type, int off, int len)
          The match method is used by the Lexer to inform the interpreter that a new token has been found at the given offset with the given length.
 Recovery recover(int type, Sentence left_context)
          This method will be called by the parser when an ERROR instruction is hit.
 Symbol reduce(int type, Sentence s)
          ParserInterpreter.reduce(int, Sentence) is called when a reduction occurs.
 void reset()
          Resets the internal state of the TranslationComponent in preparation for another translation.
 void setInput(Input in)
          Sets the current Input to the given instance.
 
Methods inherited from class com.inxar.syntacs.translator.lr.StandardLRTranslatorInterpreter
accept, error, getParser, setParser, stop
 
Methods inherited from class com.inxar.syntacs.translator.lr.AbstractLRTranslationComponent
getAuditor, getInput, getLRTranslatorGrammar, getProperties, initialize, setAuditor, setLRTranslatorGrammar, setProperties
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.inxar.syntacs.translator.lr.LRTranslationComponent
getAuditor, getInput, getLRTranslatorGrammar, getProperties, initialize, setAuditor, setLRTranslatorGrammar, setProperties
 

Constructor Detail

SyntacsInterpreter

public SyntacsInterpreter()
Method Detail

match

public void match(int type,
                  int off,
                  int len)
           throws TranslationException
Description copied from interface: LexerInterpreter
The match method is used by the Lexer to inform the interpreter that a new token has been found at the given offset with the given length.
Overrides:
match in class StandardLRTranslatorInterpreter

reduce

public Symbol reduce(int type,
                     Sentence s)
              throws TranslationException
Description copied from interface: ParserInterpreter
ParserInterpreter.reduce(int, Sentence) is called when a reduction occurs. The type of the reduction (from the grammar) as well as the top of the parse stack is passed to the method. The ParserInterpreter is expected to construct a Symbol and return it back to the Parser (to be placed at the top of the parse stack).
Overrides:
reduce in class StandardLRTranslatorInterpreter

recover

public Recovery recover(int type,
                        Sentence left_context)
                 throws TranslationException
Description copied from interface: ParserInterpreter
This method will be called by the parser when an ERROR instruction is hit. The argument is the Symbol type that was being parsed at the time of error. The return value should be a Symbol to try instead of the one that invoked the error. If the return value is null, the error will be ignored. If the return value is not null and another error is encountered, one symbol will be removed from the stack and the parser will try again wil the given return symbol. This will happen recursively until the error is resolved and the parse can continue or the stack is empty.
Overrides:
recover in class StandardLRTranslatorInterpreter

reset

public void reset()
Description copied from interface: LRTranslationComponent
Resets the internal state of the TranslationComponent in preparation for another translation.
Overrides:
reset in class AbstractLRTranslationComponent

getResult

public Object getResult()
Description copied from interface: LRTranslatorInterpreter
When translation is complete and there were no unrecoverable errors, the LRTranslatorInterpreter should be able to produce some Object which was built from the parse tree. This Object will be returned by the Translator if appropriate.
Overrides:
getResult in class StandardLRTranslatorInterpreter

setInput

public void setInput(Input in)
Description copied from interface: LRTranslationComponent
Sets the current Input to the given instance.
Overrides:
setInput in class AbstractLRTranslationComponent