All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class prolog.Parser

java.lang.Object
   |
   +----prolog.Parser

public final class Parser
extends Object
An operator-shift-precedence parser for ISO Prolog. Based loosely on that of GNU Prolog by Daniel Diaz.

Note that the externally-callable methods are not re-entrant, as they rely on fields to implement synthetic attributes.

See Also:
ParsingException

Variable Index

 o empty_list_functor
The end-of-list functor.
 o list_functor
 o NECK_ARITY
 o NECK_FUNCTOR
 o ops
The operator table for this parser.
 o QUERY_ARITY
 o QUERY_FUNCTOR

Constructor Index

 o Parser()

Method Index

 o main(String[])
Test method - parse stdin and print out the resultant tree.
 o parse(Prolog, Yylex, boolean)
Parses some prolog text and interprets it in the context of the given Prolog engine.
 o parse(Yylex)
Parses a term without interpreting it.

Variables

 o QUERY_FUNCTOR
 public static final String QUERY_FUNCTOR
 o QUERY_ARITY
 public static final int QUERY_ARITY
 o NECK_FUNCTOR
 public static final String NECK_FUNCTOR
 o NECK_ARITY
 public static final int NECK_ARITY
 o empty_list_functor
 public static final String empty_list_functor
The end-of-list functor.

 o list_functor
 public static final String list_functor
 o ops
 public final OperatorTable ops
The operator table for this parser.

Constructors

 o Parser
 public Parser()

Methods

 o parse
 public boolean parse(Prolog p,
                      Yylex lex,
                      boolean interactive) throws IOException, PrologException
Parses some prolog text and interprets it in the context of the given Prolog engine. This may involve asserting a clause, answering a query, etc. Note that only one clause/query/etc. is dealt with at a time.

Parameters:
interactive - print out variable bindings on success.
Returns:
true on end-of-file, false otherwise.
 o parse
 public Term parse(Yylex lex) throws IOException, ParsingException
Parses a term without interpreting it.

Parameters:
lex - the lexical analyzer from which we read tokens.
Throws: IOException
on stream errors.
Throws: ParsingException
on syntax/semantical errors.
 o main
 public static void main(String argv[]) throws Exception
Test method - parse stdin and print out the resultant tree.


All Packages  Class Hierarchy  This Package  Previous  Next  Index