|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--com.svincent.moksa.WamObject
|
+--com.svincent.moksa.PrologTokenizer
This class encapsulates the tokenization of Prolog.
A PrologTokenizer has a single method, 'getToken', which returns a PrologTerm. This term is one of:
atom ('name') - an atom token (i.e. -
foo, a32, '$').variable ('Name') - a variable token (i.e. -
Foo, _, and A32).integer (value)42, -3, 7).
float (value)3.141592, 42.0).
string (value)"Four score and seven years ago...",
"hello").
open().
close)).
open_list[).
close_list]).
open_curly{).
close_curly}).
head_tail_separator|).
end.).
end_of_fileerror(reason).).
All strings, etc, have quote marks stripped and escape sequences expanded, so there is no need to do these things later on.
I believe that MoksaProlog will ship with two complete parsers: one written in Prolog, which supports the entire Prolog language, and one written completely in Java, which supports a subset.
Both of these parsers, I believe, shall be accessable to Prolog users, through various and sundry APIs.
| Constructor Summary | |
PrologTokenizer(PrologFactory _factory)
|
|
| Method Summary | |
void |
consume(Io.PrologInput in,
CompoundTerm expected)
|
static void |
main(java.lang.String[] args)
Test code. |
CompoundTerm |
parseCompoundTerm(java.lang.String value)
From something of the form "Shawn" Make something of the form [83,104,97,119,110] |
CompoundTerm |
peek(Io.PrologInput in)
|
void |
pushback(Io.PrologInput in,
CompoundTerm token)
|
CompoundTerm |
readToken(Io.PrologInput in)
Read a single token from 'in'. |
| Methods inherited from class com.svincent.moksa.WamObject |
tag,
tag |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public PrologTokenizer(PrologFactory _factory)
| Method Detail |
public void pushback(Io.PrologInput in,
CompoundTerm token)
public CompoundTerm peek(Io.PrologInput in)
throws java.io.IOException
public void consume(Io.PrologInput in,
CompoundTerm expected)
throws java.io.IOException,
PrologParseException
public CompoundTerm readToken(Io.PrologInput in)
throws java.io.IOException
public CompoundTerm parseCompoundTerm(java.lang.String value)
public static void main(java.lang.String[] args)
throws java.lang.Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
This is documentation for Moksa Prolog, which can be found at http://www.svincent.com/moksa/
Copyright © 1999 Shawn P. Vincent.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.