org.xmloperator.lambda.tree.serialize
Class UsualSerializer

java.lang.Object
  |
  +--org.xmloperator.lambda.tree.serialize.UsualSerializer
All Implemented Interfaces:
Serializer

public class UsualSerializer
extends java.lang.Object
implements Serializer

Usual Expression serializer, convenient for a human reader.

--- Term syntax

 Term ::= Variable | EndOfScope | Abstraction | Application | '(' Term ')'
 Variable ::= ( 'a' | ... | 'z' ) Number?
 Number ::= ('0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9')+
 Abstraction ::= '\' VariableList '.' Term
 EndOfScope ::= '/' VariableList '.' Term
 VariableList ::= Variable+
 Application ::= Term Term
 


Constructor Summary
UsualSerializer(boolean isEndOfScopeWritenOut)
           
 
Method Summary
static void main(java.lang.String[] args)
           
 Term readTerm(java.io.Reader reader, TermFactory termFactory)
          Produces a Term from a previous serialization.
static boolean test(java.io.PrintStream out, boolean isVerbose)
          Serializes in and out some terms.
 void underlineRedex(java.io.PrintWriter out, Term rootTerm, Application underlinedRedex)
          Writes a string value that underline a redex.
 void underlineTerm(java.io.PrintWriter out, Term rootTerm, Term underlinedTerm)
          Writes a string value that underline a sub-Term.
 void writeTerm(java.io.PrintWriter out, Term rootTerm)
          Writes a Term.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UsualSerializer

public UsualSerializer(boolean isEndOfScopeWritenOut)
Method Detail

main

public static void main(java.lang.String[] args)

test

public static boolean test(java.io.PrintStream out,
                           boolean isVerbose)
Serializes in and out some terms.

Parameters:
out - the PrintStream to print results. May be null.
isVerbose - if true then all tests have to be displayed.
Returns:
true if all is Ok.

writeTerm

public void writeTerm(java.io.PrintWriter out,
                      Term rootTerm)
Description copied from interface: Serializer
Writes a Term.

Specified by:
writeTerm in interface Serializer
Parameters:
out - a PrintWriter.
rootTerm - a Term to write out.

underlineTerm

public void underlineTerm(java.io.PrintWriter out,
                          Term rootTerm,
                          Term underlinedTerm)
Description copied from interface: Serializer
Writes a string value that underline a sub-Term.

Specified by:
underlineTerm in interface Serializer
Parameters:
out - a PrintWriter.
rootTerm - a Term.
underlinedTerm - a sub-Term to underline.

underlineRedex

public void underlineRedex(java.io.PrintWriter out,
                           Term rootTerm,
                           Application underlinedRedex)
Description copied from interface: Serializer
Writes a string value that underline a redex.

Specified by:
underlineRedex in interface Serializer
Parameters:
out - a PrintWriter.
rootTerm - a Term.
underlinedRedex - a redex to underline.

readTerm

public Term readTerm(java.io.Reader reader,
                     TermFactory termFactory)
              throws java.io.IOException
Description copied from interface: Serializer
Produces a Term from a previous serialization.

Specified by:
readTerm in interface Serializer
Parameters:
reader - a Reader.
termFactory - the factory for building the Term.
Returns:
the created Term.
java.io.IOException