
Orbital library  
PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
public interface ExpressionSyntax
Defines general methods for constructing and handling expressions of a formal language. Implementations of this interface are responsible for analyzing and constructing expressions (like terms, formulas) in the language of the corresponding term algebra defining a specific abstract syntax.
ExpressionSyntax defines a formal language over an alphabet and thus has a corresponding description with a Chomsky grammar defining its abstract syntax. It only defines the abstract syntax in terms of composition (in the sense of semiotics) of signs, whilst the concrete syntax is determined by the parser and the notations of the symbols involved. Implementations define the syntax for the set of legal expressions over a given signature Σ (including a set V of variables and any core symbols). Its language L(Σ) is the set of all wellformed expressions according to this syntax. It is usually a requirement that this language L(Σ) is a decidable set of finite objects over the alphabet Σ, and the alphabet Σ itself is decidable, as well.
Note that the null pointer null
is neither an expression
nor a symbol,
i.e. we generally assume that null
∉L(Σ)∪Σ.
Method Summary  

Signature 
coreSignature()
Get the core signature which is supported by the language of this expression syntax. 
Expression 
createExpression(java.lang.String expression)
Create a term representation by parsing a (compound) expression. 
Signature 
scanSignature(java.lang.String expression)
Scan for the signature Σ of all syntactic symbols in an expression. 
Methods inherited from interface orbital.logic.sign.ExpressionBuilder 

compose, createAtomic 
Method Detail 

Signature coreSignature()
The core "signature" contains the logical signs that inherently belong to this term algebra and are not subject to interpretation. Logical signs are logical constants like true, false, and logical operators like ¬, ∧, ∨, →, ∀, ∃. The latter are also called logical junctors.
Note that some authors do not count the core "signature" as part of the proper signature Σ but would rather call it "meta"signature.
Logic.coreInterpretation()
Signature scanSignature(java.lang.String expression) throws ParseException
However, note that this method does not necessarily perform rich type querying. Especially for userdefined functions with an arbitrary argumenttype structure, it is generally recommended to construct the relevant signature entries explicitly.
expression
 the expression that should be scanned for symbol names.
ParseException
 (optional) when the expression is syntactically malformed.
Either due to a lexical or grammatical error.
(optional behaviour for performance reasons).
Will not throw ParseExceptions if createExpression would not either.coreSignature()
,
"Factory Method"Expression createExpression(java.lang.String expression) throws ParseException, TypeException, java.lang.IllegalArgumentException
In fact, parsing expressions is only possible with a concrete syntax. So implementations of this method are encouraged to define and parse a standard notation which can often be close to the default notation of the abstract syntax.
expression
 the compound expression to parse.
A string of ""
denotes the empty expression.
However note that the empty expression may not be accepted in some term algebras.
Those parsers rejecting the empty expression are then inclined to throw a ParseException,
instead.
ParseException
 when the expression is syntactically malformed.
Either due to a lexical or grammatical error.
TypeException
 if the expression produces a type
error. 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.
java.lang.IllegalArgumentException
 if the symbol is illegal for some reasons.
This may occur like in ExpressionBuilder.createAtomic(Symbol)
, and due to the same reasons.
However, most of the causes (like f.ex. spaces in the signifier) cannot occur here anyway,
except when the parser underlying this method's implementation had errors.

Orbital library 1.3.0: 11 Apr 2009 

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 