public class ZLive extends Object
Modifier and Type | Field and Description |
---|---|
static int |
INFER_PASSES
The maximum number of static inference passes done
prior to mode checking and evaluation.
|
protected FlatPredList |
predlist_
Stores the code used in the most recent evaluation.
|
protected net.sourceforge.czt.session.SectionManager |
sectman_ |
Constructor and Description |
---|
ZLive() |
Modifier and Type | Method and Description |
---|---|
void |
compile(ZLiveResult result)
Processes and compiles a term into internal FlatPred form.
|
net.sourceforge.czt.z.ast.ZName |
createNewName()
Generates a fresh temporary name.
|
net.sourceforge.czt.z.ast.Expr |
evalExpr(net.sourceforge.czt.z.ast.Expr expr)
Evaluate an Expr.
|
net.sourceforge.czt.z.ast.Pred |
evalPred(net.sourceforge.czt.z.ast.Pred pred)
Evaluate a Pred.
|
net.sourceforge.czt.z.ast.Expr |
evalSchema(String string,
net.sourceforge.czt.z.ast.BindExpr expr) |
ZLiveResult |
evalTerm(boolean expr,
net.sourceforge.czt.base.ast.Term term,
Envir env0)
Evaluate an expression or predicate.
|
void |
evaluate(ZLiveResult result)
Evaluates a term that has already been preprocessed and compiled.
|
static String |
getBanner()
Returns the name and current version of ZLive.
|
String |
getCurrentSection()
Which section evaluations are being done in.
|
net.sourceforge.czt.z.util.Factory |
getFactory()
Returns the factory used for creating AST objects.
|
Flatten |
getFlatten()
Get a flatten visitor.
|
int |
getGivenSetSize()
The maximum size of each given set.
|
net.sourceforge.czt.session.Markup |
getMarkup() |
Preprocess |
getPreprocess()
Get the Preprocess object that is used to unfold terms
before evaluation.
|
double |
getSearchSize()
Set the maximum acceptable cost for evaluating each FlatPredList.
|
net.sourceforge.czt.session.SectionManager |
getSectionManager()
Get the current section manager.
|
static String |
getVersion()
Returns the version number as a String, or "unknown" if an error
occured when accessing the property containing the version
information.
|
static boolean |
isNewName(net.sourceforge.czt.z.ast.ZName name)
Recognises the Names produced by createNewName.
|
static void |
main(String[] args) |
void |
printCode(FlatPredList code,
PrintWriter writer)
Prints the given list of FlatPreds.
|
void |
printTerm(PrintStream out,
net.sourceforge.czt.base.ast.Term term)
Print any term (evaluated or not), using the current markup.
|
void |
printTerm(PrintWriter writer,
net.sourceforge.czt.base.ast.Term term)
Print any term (evaluated or not), using the current markup.
|
void |
printTerm(PrintWriter out,
net.sourceforge.czt.base.ast.Term term0,
net.sourceforge.czt.session.Markup markup)
Write an evaluated term.
|
void |
reset()
Reset the section manager that will be used during evaluation.
|
void |
resetNewNames()
This can be called to reset the new name counter to 0.
|
net.sourceforge.czt.z.ast.Expr |
schemaExpr(String schemaName)
Converts a schema name into an expression that can be evaluated.
|
void |
setCurrentSection(String sectName)
Sets the current section to the one whose name is sectName.
|
void |
setFactory(net.sourceforge.czt.z.util.Factory fact)
Sets the AST factory used for creating AST objects.
|
void |
setGivenSetSize(String value)
Set the maximum size of all given sets.
|
void |
setMarkup(net.sourceforge.czt.session.Markup markup)
Sets the markup that will be used to parse and print terms.
|
void |
setMarkup(String markup) |
void |
setSearchSize(double num) |
void |
setSearchSize(String str) |
String |
termToString(net.sourceforge.czt.base.ast.Term term)
Converts the given term to a String, using the current markup.
|
String |
termToString(net.sourceforge.czt.base.ast.Term term,
net.sourceforge.czt.session.Markup markup)
Converts the given term to a String.
|
void |
typecheck(net.sourceforge.czt.base.ast.Term term)
Typechecks a term, to check its correctness and to
reestablish the unique-ids invariant of bound variables.
|
net.sourceforge.czt.z.ast.BindExpr |
unprime(net.sourceforge.czt.z.ast.BindExpr expr)
Converts an output BindExpr to an input BindExpr.
|
public static final int INFER_PASSES
FlatPredList.inferBoundsFixPoint(Bounds,int)
,
Constant Field Valuesprotected net.sourceforge.czt.session.SectionManager sectman_
protected FlatPredList predlist_
public void resetNewNames()
public net.sourceforge.czt.z.ast.ZName createNewName()
public static boolean isNewName(net.sourceforge.czt.z.ast.ZName name)
public net.sourceforge.czt.z.util.Factory getFactory()
public void setFactory(net.sourceforge.czt.z.util.Factory fact)
public Preprocess getPreprocess()
public net.sourceforge.czt.session.SectionManager getSectionManager()
public void reset()
public Flatten getFlatten()
public net.sourceforge.czt.session.Markup getMarkup()
public void setMarkup(net.sourceforge.czt.session.Markup markup)
public void setMarkup(String markup)
IllegalArgumentException
- if the given markup is not supported.public int getGivenSetSize()
public void setGivenSetSize(String value)
NumberFormatException
- if the argument
string is not a positive integer.public double getSearchSize()
public void setSearchSize(double num)
public void setSearchSize(String str)
public String getCurrentSection()
public void setCurrentSection(String sectName) throws net.sourceforge.czt.session.CommandException
net.sourceforge.czt.session.CommandException
public net.sourceforge.czt.z.ast.Pred evalPred(net.sourceforge.czt.z.ast.Pred pred) throws EvalException
pred
- A net.sourceforge.czt.z.ast.Pred object.EvalException
public net.sourceforge.czt.z.ast.Expr evalExpr(net.sourceforge.czt.z.ast.Expr expr) throws EvalException
expr
- A net.sourceforge.czt.z.ast.Expr object.EvalException
public ZLiveResult evalTerm(boolean expr, net.sourceforge.czt.base.ast.Term term, Envir env0)
public void compile(ZLiveResult result)
result
- resultgetOriginalTerm() is the term to be compiled.public void evaluate(ZLiveResult result)
result
- the code and mode must be already set.public net.sourceforge.czt.z.ast.Expr schemaExpr(String schemaName) throws EvalException, net.sourceforge.czt.session.CommandException
schemaName
- The undecorated name of a schema.net.sourceforge.czt.util.CztException
- if schemaName is not defined.EvalException
net.sourceforge.czt.session.CommandException
public void typecheck(net.sourceforge.czt.base.ast.Term term) throws EvalException, net.sourceforge.czt.typecheck.z.util.TypeErrorException
EvalException
net.sourceforge.czt.typecheck.z.util.TypeErrorException
public void printCode(FlatPredList code, PrintWriter writer)
public void printTerm(PrintStream out, net.sourceforge.czt.base.ast.Term term)
public void printTerm(PrintWriter writer, net.sourceforge.czt.base.ast.Term term)
public void printTerm(PrintWriter out, net.sourceforge.czt.base.ast.Term term0, net.sourceforge.czt.session.Markup markup)
public String termToString(net.sourceforge.czt.base.ast.Term term, net.sourceforge.czt.session.Markup markup)
public String termToString(net.sourceforge.czt.base.ast.Term term)
public static String getBanner()
public static String getVersion()
public static void main(String[] args)
public net.sourceforge.czt.z.ast.BindExpr unprime(net.sourceforge.czt.z.ast.BindExpr expr)
expr
- Eg. <| x==1, x'==2, y''==3, i?==4, o!==5 |>public net.sourceforge.czt.z.ast.Expr evalSchema(String string, net.sourceforge.czt.z.ast.BindExpr expr) throws net.sourceforge.czt.session.CommandException
net.sourceforge.czt.session.CommandException
Copyright © 2003–2016 Community Z Tools Project. All rights reserved.