Interface Parser


  • public interface Parser
    Instances of the Parser interface are used to convert a code string representing an arithmetic expression in a tree of terms which can then be executed by using one of the evaluation methods of the Term class.
    Version:
    $Revision$ $Date$
    • Method Detail

      • getDefaultNamespace

        Namespace getDefaultNamespace()
        Gets this parser's default namespace.
        Returns:
        the default environment used to resolve names.
      • parse

        Term parse​(String code)
            throws ParseException
        Parses the expression given in the code string. Names in the code string are resolved using the default namespace.
        Parameters:
        code - the code string, for the syntax of valid expressions refer to the class description
        Returns:
        the the parsed code as Term
        Throws:
        ParseException - if a parse reportError occurs
      • parse

        Term parse​(String code,
                   Namespace namespace)
            throws ParseException
        Parses the expression given in the code string. Names in the code string are resolved using the given namespace.
        Parameters:
        code - the code string, for the syntax of valid expressions refer to the class description
        namespace - the environment which is used to resolve names
        Returns:
        the the parsed code as Term
        Throws:
        ParseException - if a parse error occurs