ix.iface.domain
Class LTF_Parser
java.lang.Object
ix.iface.domain.DomainParser
ix.iface.domain.LTF_Parser
- All Implemented Interfaces:
- LTF_Symbols
public class LTF_Parser
- extends DomainParser
- implements LTF_Symbols
A parser for domains described in a Lisp-like syntax.
The parser parses a file of refinement definitions to populate
a Domain.
In the syntax definitions below, all-upper-case names are literals
and lower- and mixed-case names are syntactic variables. Literals
should actually be written in lower case in domain definitions.
domain ::= {header | refinement | object-class | annotations | include}*
header ::= (DOMAIN domain-property*)
domain-property ::= (NAME string)
include ::= (INCLUDE file-name-or-URL-as-string)
refinement ::= (REFINEMENT name pattern clause*)
name ::= symbol | string
pattern ::= (item*)
item ::= number | symbol | string | pattern | variable
variable ::= ?symbol
clause ::= (VARIABLES variable-declaration*)
| (ISSUES issue*)
| (NODES node*)
| (ORDERINGS ordering*)
| (CONSTRAINTS constraint*)
| annotations
variable-declaration = variable
issue ::= (ISSUE pattern)
node ::= (node-id pattern)
ordering ::= ({node-end-ref | (node-end-ref*)}*)
constraint ::= (WORLD-STATE CONDITION pattern = value)
| (WORLD-STATE EFFECT pattern = value)
| (COMPUTE [MULTIPLE-ANSWER] pattern = value)
| (ADVICE EXPANSION-REFINEMENT verb (symbol*))
| (TEMPORAL DURATION SELF = min-duration .. max-duration)
| (RESOURCE operation pattern = value)
| other-constraint
other-constraint ::= (type subtype pattern = value)
node-id ::= number | symbol | string
node-end-ref ::= node-id | B/node-id | E/node-id
value ::= item
verb, operation, type, subtype ::= symbol
min-duration, max-duration ::= duration
A duration has ISO 8601 syntax for days, hours, minutes, seconds
and milliseconds.
object-class ::= (OBJECT-CLASS class-name supers object-property*)
supers = (class-name*)
object-property ::= (property-name [class-name] [:SYNTAX value-syntax])
class-name ::= symbol | string
property-name ::= symbol | string
value-syntax ::= NUMBER | SYMBOL | STRING | LIST | OBJECT | DEFAULT
annotations :: = (ANNOTATIONS annotation*)
annotation ::= (aKey = aValue)
map ::= (MAP map-entry*)
map-entry ::= (aKey = aValue)
aKey and aValue can be anything the Lisp reader will accept.
aValue can also be a map. The word map must be written
"Map".
- See Also:
Domain
,
Duration
,
expandAllOrderings(LList)
Fields inherited from interface ix.iface.domain.LTF_Symbols |
K_SYNTAX, Q_MAX, Q_MIN, Q_PATTERN, Q_VALUE, S_ANNOTATIONS, S_CONSTRAINTS, S_DOMAIN, S_INCLUDE, S_ISSUE, S_ISSUES, S_MAP, S_NAME, S_NODES, S_OBJECT_CLASS, S_ORDERINGS, S_REFINEMENT, S_SELF, S_VARIABLES |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
sourceName
protected java.lang.String sourceName
lin
protected LispReader lin
lastRead
protected java.lang.Object lastRead
forceNumericNodeIds
protected boolean forceNumericNodeIds
badAnnotationsAreErrors
protected boolean badAnnotationsAreErrors
badAnnotations
protected java.util.Set badAnnotations
otherConstraints
protected java.util.Set otherConstraints
parsers
protected MatchTable parsers
LTF_Parser
public LTF_Parser(java.lang.String filename)
throws java.io.FileNotFoundException
- Throws:
java.io.FileNotFoundException
LTF_Parser
public LTF_Parser(java.io.File file)
throws java.io.FileNotFoundException
- Throws:
java.io.FileNotFoundException
LTF_Parser
public LTF_Parser(java.net.URL url)
throws java.io.IOException
- Throws:
java.io.IOException
LTF_Parser
public LTF_Parser()
readDomain
public Domain readDomain()
- Specified by:
readDomain
in class DomainParser
readDomain
public Domain readDomain(Domain dom)
- Specified by:
readDomain
in class DomainParser
do_readDomain
protected void do_readDomain(Domain dom)
syntaxError
protected SyntaxException syntaxError(java.lang.String message)
theCons
protected static Cons theCons(java.lang.Object o)
theLList
protected static LList theLList(java.lang.Object o)
theSymbol
protected static Symbol theSymbol(java.lang.Object o)
theString
protected static java.lang.String theString(java.lang.Object o)
theName
protected static java.lang.String theName(java.lang.Object o)
theNodeId
protected static Name theNodeId(java.lang.Object o)
theNodeEndRef
protected static NodeEndRef theNodeEndRef(Name nodeId,
End defaultEnd)
makeRefinement
public Refinement makeRefinement(LList def)
makeVarDcls
public ix.icore.domain.ListOfVariableDeclaration makeVarDcls(LList items)
makeNodes
public ix.icore.domain.ListOfNodeSpec makeNodes(LList items)
makeOrderings
public ix.icore.domain.ListOfOrdering makeOrderings(LList items)
makeConstraints
public ix.icore.domain.ListOfConstraint makeConstraints(LList items)
makeIssues
public ix.icore.ListOfIssue makeIssues(LList items)
expandAllOrderings
public static LList expandAllOrderings(LList orderings)
- Expands a list of orderings into a list of simple orderings.
Each simple ordering is a pair of node ids: (before after).
Each ordering is a list representing a sequence. Consider
adjacent elements A and B in such a list. Each node in A is
linked before each node in B. For example, (1 (2 3) 4) is
equivalent to the four separate lists (1 2), (1 3), (2 4), (3 4).
expandOrdering
public static LList expandOrdering(LList ordering)
parseConstraint
public Constraint parseConstraint(java.lang.Object spec)
getConstraintParsers
public MatchTable getConstraintParsers()
addConstraintParsers
protected void addConstraintParsers()