|
Orbital library | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ExpressionBuilder
Defines a general interface for constructing complex expressions. Implementations of this interface are responsible for constructing compound expressions (like terms, formulas). They usually correspond to a formal language of a corresponding abstract syntax for expressions. This interface effectively works as a builder for syntactic expressions.
Refer to the ParseException dilemma
to read about
why the exception types may have to change some day.
Expression
,
BuilderMethod Summary | |
---|---|
Expression.Composite |
compose(Expression compositor,
Expression[] arg)
Create a compound expression representation with a composition operation. |
Expression |
createAtomic(Symbol symbol)
Create an atomic expression representation of a non-compound sign. |
Method Detail |
---|
Expression createAtomic(Symbol symbol) throws java.lang.IllegalArgumentException
Atomic symbols are either elemental atoms, strings or numbers. ☡ In contrast, a logical formula that is not compound of something (on the level of logical junctors) like "P(x,y)" is sometimes called atom.
symbol
- the symbol whose atomic expression representation to create.
java.lang.IllegalArgumentException
- if the symbol is illegal for some reasons.
Note that this is a rather rare case and no parsing is involved at all,
which is why this method does not throw a ParseException.Expression.Composite compose(Expression compositor, Expression[] arg) throws ParseException, TypeException
Signature.get(String,Object[])
may be useful for determining the right functor symbol
for a composition in case of an atomic
compositor.
☡ Be aware that this method does a composition (in the sense of semiotics) of signs/expressions, but not usually a composition (in the sense of mathematics) of functions. Mathematically speaking, the composition that this method performs would usually be called application instead of composition. Although composition (in the sense of mathematics) and application are correlated, they have different types at first sight
Yet together withλ
-abstraction,
composition can be expressed in terms of application (as the definition above shows).
And in conjunction with the (selective) identification of type
void→σ' with σ'
application can also be expressed per composition.
compositor
- the expression that is used for composing the arguments.arg
- the arguments a
passed to the combining operation.
compositor(a[0],…,a[a.length-1])
ParseException
- if the composition expression is syntactically malformed.
Either due to a lexical or grammatical error (also due to wrong type of arguments).
TypeException
- if the arguments have the wrong type for
composition, i.e. compositor.getType().on(typeOf(arg)) raises a
TypeException. Note that type errors are still a kind of
syntactic errors, but should be separated from pure parse
exceptions in order to simplify distinction for exception
handlers.
|
Orbital library 1.3.0: 11 Apr 2009 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |