de.saar.chorus.domgraph.codec.glue
Class GlueInputCodec
Object
InputCodec
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
Methods inherited from class Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
token_source
public GlueInputCodecTokenManager token_source
token
public Token token
jj_nt
public Token jj_nt
lookingAhead
public boolean lookingAhead
GlueInputCodec
public GlueInputCodec()
GlueInputCodec
public GlueInputCodec(InputStream stream)
GlueInputCodec
public GlueInputCodec(InputStream stream,
String encoding)
GlueInputCodec
public GlueInputCodec(Reader stream)
GlueInputCodec
public GlueInputCodec(GlueInputCodecTokenManager tm)
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 readgraph
- the dominance graph into which the USR is convertedlabels
- 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 Formula formula()
throws ParseException
- Throws:
ParseException
VarOrAtom
public final Formula VarOrAtom()
throws ParseException
- Throws:
ParseException
ReInit
public void ReInit(InputStream stream)
ReInit
public void ReInit(InputStream stream,
String encoding)
ReInit
public void ReInit(Reader stream)
ReInit
public void ReInit(GlueInputCodecTokenManager tm)
getNextToken
public final Token getNextToken()
getToken
public final Token getToken(int index)
generateParseException
public ParseException generateParseException()
enable_tracing
public final void enable_tracing()
disable_tracing
public final void disable_tracing()