All Packages Class Hierarchy This Package Previous Next Index
Class mathbus.parse.MBConvert
java.lang.Object
|
+----mathbus.parse.MBConvert
- public class MBConvert
- extends Object
Class to encapsulate converters to and from the MathBus term structure
and formats of various algebra systems (and other systems).
- See Also:
- Node, YYMBMapleParse, YYMBMathematicaParse
-
debugLevel
-
-
eBase64Code
-
-
eMaple
-
-
eMathematica
-
-
eMBParenAscii
-
-
ErrorString
-
-
MapleFunctions
-
-
MathematicaFunctions
-
-
theParsedNode
- The parser classes will copy the constructed tree
to this variable.
-
UnicodeAscii
-
-
MBConvert()
-
-
MBConvert(int)
- Constructs a convert object with Lex and Bison debug information
switched on according to the given debugInfo.
-
charEscape(int)
- Converts the decimal value of an ascii character into either a single
character string or an escape sequence if not an ascii character.
-
convertUnicode(String)
- Converts a unicode string to an Ascii string translating the Greek
letters and other strange things in to sequences of ascii characters.
-
DeclFunctionName(String, String, String)
-
-
getMathematicaFunctionName(Node)
- Translates a mathbus name into a Mathematica name
for the special functions; if no special name
is found, the identifier corresponding to the
label is returned.
-
MapleNoSquotesNecessary(String)
- Checks whether the string s can be used as a Maple identifier
without enclosing ` and `.
-
MathematicaNoQuotesNecessary(String)
-
-
parseNode(InputStream, int)
- Parses the underlying MathBus tree from the InputStream stream, assuming
that the input is given in a syntax specified by parseMode, which can be
one of: eBase64Code, eMBParenAscii, eMaple, eMathematica
at the moment.
-
printInSyntax(Node, OutputStream, int)
- Prints the Node n in a syntax corresponding to the one given by
printMode to the OutputStream stream.
-
printMapleAbstractedAlgFun(Node, OutputStream)
- Prints a functional expression containing lambda
abstractions in the Maple format.
-
printMapleInfixSubterms(SubtermEnumeration, OutputStream, String, int)
-
-
printMapleNode(Node, OutputStream)
- The major function to print a Node in Maple syntax.
-
printMapleNodeRec(Node, OutputStream, int)
- Recursive function to print a Node in Maple syntax.
-
printMathematicaAppliedAlgFun(Node, OutputStream)
- Prints the application of a function
to its arguments in Mathematica syntax.
-
printMathematicaInfixSubterms(SubtermEnumeration, OutputStream, String, int)
-
-
printMathematicaNode(Node, OutputStream)
- The major function to print a Node in Mathematica syntax.
-
printMathematicaNodeRec(Node, OutputStream, int)
-
-
printString(String, OutputStream)
-
Prints the low-byte part of the (unicode) string
to the stream.
-
stringEscape(String)
- Converts a unicode string to an Ascii string escaping the
non-ascii characters.
-
UnicodeAsciiRel(int, String)
-
debugLevel
protected int debugLevel
eBase64Code
public static final int eBase64Code
eMBParenAscii
public static final int eMBParenAscii
eMaple
public static final int eMaple
eMathematica
public static final int eMathematica
theParsedNode
public static Node theParsedNode
- The parser classes will copy the constructed tree
to this variable.
The constructed tree inside the parsers is
stored in yyval, but this variable
is protected and thus cannot be accessed
by MBConvert. Therefore MBConvert provides a public
variable that can be accessed by the parsers.
- See Also:
- YYMBMapleParse, yyval, parseNode
UnicodeAscii
public static Hashtable UnicodeAscii
MapleFunctions
public static Hashtable MapleFunctions
MathematicaFunctions
public static Hashtable MathematicaFunctions
ErrorString
public static String ErrorString
MBConvert
public MBConvert()
MBConvert
public MBConvert(int debugInfo)
- Constructs a convert object with Lex and Bison debug information
switched on according to the given debugInfo.
(debugInfo = 0 is no debug Information, debugInfo > 0 gives some.)
UnicodeAsciiRel
protected static void UnicodeAsciiRel(int uni,
String str)
DeclFunctionName
protected static void DeclFunctionName(String mb,
String maple,
String math)
parseNode
public synchronized Node parseNode(InputStream stream,
int parseMode)
- Parses the underlying MathBus tree from the InputStream stream, assuming
that the input is given in a syntax specified by parseMode, which can be
one of: eBase64Code, eMBParenAscii, eMaple, eMathematica
at the moment.
- Parameters:
- stream - the input stream
- parseMode - the syntax the data in the stream are supposed to
be in
- Returns:
- the parsed structure as a mathbus term structure
- See Also:
- printInSyntax, eBase64Code, eMBParenAscii, eMaple, eMathematica
printInSyntax
public static void printInSyntax(Node n,
OutputStream stream,
int printMode) throws NodeException, IOException
- Prints the Node n in a syntax corresponding to the one given by
printMode to the OutputStream stream.
- Parameters:
- n - the node to be printed
- stream - the used output stream
- printMode - the syntax to be used
- Throws: NodeException
- the mathbus term structure contains commands
that cannot be converted into the given syntax
- Throws: IOException
- indicates problems writing to stream
- See Also:
- parseNode, eBase64Code, eMBParenAscii, eMaple, eMathematica
printMapleNode
public static void printMapleNode(Node n,
OutputStream stream) throws NodeException, IOException
- The major function to print a Node in Maple syntax.
printMapleNodeRec
protected static void printMapleNodeRec(Node n,
OutputStream stream,
int topPrecedence) throws NodeException, IOException
- Recursive function to print a Node in Maple syntax. Precidence levels are
used to control the generation of parentheses in the output.
- Precedences:
- 5: EquationEqual
- 10: Plus
- 20: Times
- 30: Exponentiate
printMapleAbstractedAlgFun
protected static void printMapleAbstractedAlgFun(Node n,
OutputStream stream) throws NodeException, IOException
- Prints a functional expression containing lambda
abstractions in the Maple format.
(Will always use -> or unapply even for the special functions
in order to allow Currying.)
MapleNoSquotesNecessary
public static boolean MapleNoSquotesNecessary(String s)
- Checks whether the string s can be used as a Maple identifier
without enclosing ` and `.
convertUnicode
public static String convertUnicode(String uni)
- Converts a unicode string to an Ascii string translating the Greek
letters and other strange things in to sequences of ascii characters.
stringEscape
public static String stringEscape(String uni)
- Converts a unicode string to an Ascii string escaping the
non-ascii characters.
charEscape
public static String charEscape(int c)
- Converts the decimal value of an ascii character into either a single
character string or an escape sequence if not an ascii character.
printMapleInfixSubterms
protected static void printMapleInfixSubterms(SubtermEnumeration enum,
OutputStream stream,
String infixOp,
int topPrecedence) throws IOException, NodeException
printString
public static void printString(String s,
OutputStream stream) throws IOException
- Prints the low-byte part of the (unicode) string
to the stream. Because of the unicode encoding
no truncation occurs for iso-latin1 characters.
printMathematicaNode
public static void printMathematicaNode(Node n,
OutputStream stream) throws NodeException, IOException
- The major function to print a Node in Mathematica syntax.
printMathematicaNodeRec
protected static void printMathematicaNodeRec(Node n,
OutputStream stream,
int topPrecedence) throws NodeException, IOException
printMathematicaAppliedAlgFun
protected static void printMathematicaAppliedAlgFun(Node n,
OutputStream stream) throws NodeException, IOException
- Prints the application of a function
to its arguments in Mathematica syntax.
getMathematicaFunctionName
public static String getMathematicaFunctionName(Node n) throws NodeException
- Translates a mathbus name into a Mathematica name
for the special functions; if no special name
is found, the identifier corresponding to the
label is returned.
MathematicaNoQuotesNecessary
public static boolean MathematicaNoQuotesNecessary(String s)
printMathematicaInfixSubterms
protected static void printMathematicaInfixSubterms(SubtermEnumeration enum,
OutputStream stream,
String infixOp,
int topPrecedence) throws IOException, NodeException
All Packages Class Hierarchy This Package Previous Next Index