org.ofbiz.rules.logikus |
|
Java Source File Name | Type | Comment |
Anonymous.java | Class | Title: Anonymous
Description: None
Copyright (c) 1999 Steven J. |
AnonymousAssembler.java | Class | Title: Anonymous Assembler
Description: None
Copyright (c) 1999 Steven J. |
ArithmeticAssembler.java | Class | Title: Arithmetic Assembler
Description: None
Copyright (c) 1999 Steven J. |
AtomAssembler.java | Class | Title: Atom Assembler
Description: None
Copyright (c) 1999 Steven J. |
AxiomAssembler.java | Class | Title: Axiom Assembler
Description: None
Copyright (c) 1999 Steven J. |
ComparisonAssembler.java | Class | Title: Comparison Assembler
Description: None
Copyright (c) 1999 Steven J. |
EvaluationAssembler.java | Class | Pops two terms, constructs an Evaluation from these terms, and pushes it.
author: Steven J. |
ListAssembler.java | Class | Title: List Assembler
Description: None
Copyright (c) 1999 Steven J. |
ListWithTailAssembler.java | Class | Title: List With Tail Assembler
Description: None
Copyright (c) 1999 Steven J. |
LogikusException.java | Class | Title: Logikus Exception
Description: None
Copyright (c) 1999 Steven J. |
LogikusFacade.java | Class | This class provides utility methods that simplify the use of the Logikus parser.
author: Steven J. |
LogikusIde.java | Class | Title: Logikus IDE
Description: None
Copyright (c) 1999 Steven J. |
LogikusMediator.java | Class | This class supports a LogikusIde object, handling the interaction of the IDE's components.
An object of the IDE (Interactive Development
Environment) has text areas for a Logikus program, a
query against the program, and for the results of a
query.
When a user clicks on the "Next" or "Rest" button, the
mediator parses the program (if it has changed), and
parses the query (if the query has changed). |
LogikusParser.java | Class | This class provides a parser for Logikus, a logic
language similar to Prolog.
The grammar this class supports is:
structure = functor ('(' commaList(term) ')' | Empty);
functor = '.' | LowercaseWord | QuotedString;
term = structure | Num | list | variable;
variable = UppercaseWord | '_';
factor = '(' expression ')' | Num | variable;
axiom = structure (ruleDef | Empty);
structure = functor ('(' commaList(term) ')');
functor = '.' | LowercaseWord | UppercaseWord;
term = structure | Num | QuotedString | list | variable;
variable = LowercaseWord | UppercaseWord | '_';
ruleDef = ":-" commaList(condition);
condition = structure | not | evaluation | comparison | list;
not = "not" structure ;
evaluation = '#' '(' arg ',' arg ')';
comparison = operator '(' arg ',' arg ')';
arg = expression | functor;
operator = '<' | '>' | '=' | "<=" | ">=" | "!=" ;
expression = phrase ('+' phrase | '-' phrase)*;
phrase = factor ('*' factor | '/' factor)*;
factor = '(' expression ')' | Num | QuotedString | variable;
list = '[' (listContents | Empty) ']';
listContents = commaList(term) listTail;
listTail = ('|' (variable | list)) | Empty;
commaList(p) = p (',' p)*;
The following program and query use most of the features of
the Logikus grammar:
// program
member(X, [X | Rest]);
member(X, [Y | Rest]) :- member(X, Rest);
primes([2, 3, 5, 7, 11, 13]);
factor(X, P, Q) :-
primes(Primes),
member(P, Primes), member(Q, Primes), =(P*Q, X);
// query
factor(91, A, B)
// results
A = 7.0, B = 13.0
A = 13.0, B = 7.0
no
The class LogikusFacade simplifies the
construction of Program and Query
objects from the text given above. |
NotAssembler.java | Class | Title: Logikus Exception
Description: None
Copyright (c) 1999 Steven J. |
StructureWithTermsAssembler.java | Class | Pops the terms and functor of a structure from an assembly's stack, builds a structure, and pushes it.
author: Steven J. |
VariableAssembler.java | Class | Pops a string like "X" or "Person" from an assembly's stack and pushes a variable with that name.
author: Steven J. |