Class GlueInputCodec

java.lang.Object
de.saar.chorus.domgraph.codec.InputCodec
de.saar.chorus.domgraph.codec.glue.GlueInputCodec
All Implemented Interfaces:
GlueInputCodecConstants

public class GlueInputCodec extends InputCodec implements GlueInputCodecConstants
An experimental input codec for LFG-style Glue Semantics axiom sets. The purpose of this codec is for experimenting with different translations of Glue to dominance graphs in the context of Etienne's MSc thesis.

The concrete syntax of the input is ad-hoc and doesn't reflect the format of the formulas computed by the XLE. Glue formulas can be built up from variables (starting with uppercase letters), atoms (starting with lowercase letters), and the implication symbol -o. If the antecedent of an implication is not atomic (i.e. not an atom or a variable), then it must be surrounded by brackets. The consequent of an implication may never be in brackets. We will presumably switch to a different concrete syntax at some point, so there's no point in making the parser perfect right now.

An example input looks as follows:

[(((X -o z) -o w) -o a) -o Y, (X -o a) -o b -o c, Y]

Author:
Etienne Ailloud, Alexander Koller
  • Field Details

  • Constructor Details

    • GlueInputCodec

      public GlueInputCodec()
    • GlueInputCodec

      public GlueInputCodec(InputStream stream)
      Constructor with InputStream.
    • GlueInputCodec

      public GlueInputCodec(InputStream stream, String encoding)
      Constructor with InputStream and supplied encoding
    • GlueInputCodec

      public GlueInputCodec(Reader stream)
      Constructor.
    • GlueInputCodec

      public GlueInputCodec(GlueInputCodecTokenManager tm)
      Constructor with generated Token Manager.
  • Method Details

    • decode

      public void decode(Reader inputStream, DomGraph graph, NodeLabels labels) throws IOException, ParserException, MalformedDomgraphException
      Description copied from class: InputCodec
      Reads an USR representation from a Reader. This method converts the USR into an equivalent labelled dominance graph and stores this graph in a DomGraph and the labels in a NodeLabels object. You must implement this method in every concrete input codec.

      The graph and labels objects passed to this method need not be empty; it is the responsibility of this method to clear them first.

      Specified by:
      decode in class InputCodec
      Parameters:
      inputStream - the reader from which the USR is read
      graph - the dominance graph into which the USR is converted
      labels - the node labels of the labelled dominance graph
      Throws:
      IOException - if an I/O error occurred while reading from reader
      ParserException - if a syntactic error occurred while parsing the USR
      MalformedDomgraphException - if a semantic error occurred, i.e. the USR cannot be converted into a dominance graph
    • list

      public final void list() throws ParseException
      Throws:
      ParseException
    • formula

      public final de.saar.chorus.domgraph.codec.glue.Formula formula() throws ParseException
      Throws:
      ParseException
    • VarOrAtom

      public final de.saar.chorus.domgraph.codec.glue.Formula VarOrAtom() throws ParseException
      Throws:
      ParseException
    • ReInit

      public void ReInit(InputStream stream)
      Reinitialise.
    • ReInit

      public void ReInit(InputStream stream, String encoding)
      Reinitialise.
    • ReInit

      public void ReInit(Reader stream)
      Reinitialise.
    • ReInit

      public void ReInit(GlueInputCodecTokenManager tm)
      Reinitialise.
    • getNextToken

      public final Token getNextToken()
      Get the next Token.
    • getToken

      public final Token getToken(int index)
      Get the specific Token.
    • generateParseException

      public ParseException generateParseException()
      Generate ParseException.
    • enable_tracing

      public final void enable_tracing()
      Enable tracing.
    • disable_tracing

      public final void disable_tracing()
      Disable tracing.