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 ::= {refinement | object-class annotations | include}*
include ::= (INCLUDE resource-name-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-id | (node-id*)}*)
constraint ::= (WORLD-STATE CONDITION pattern = value)
| (WORLD-STATE EFFECT pattern = value)
| (COMPUTE pattern = value)
| (ADVICE EXPANSION-REFINEMENT verb (symbol*))
value ::= item
verb ::= symbol
object-class ::= (OBJECT-CLASS object-class-name supers object-property*)
supers = (object-class-name*)
object-property ::= (name object-class-name)
object-class-name ::= symbol | string
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
,
expandAllOrderings(LList)
Fields inherited from interface ix.iface.domain.LTF_Symbols |
Q_MAX, Q_MIN, Q_PATTERN, Q_VALUE, S_ANNOTATIONS, S_CONSTRAINTS, S_INCLUDE, S_ISSUE, S_ISSUES, S_MAP, 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
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)
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)
useNumericNodeIds
Refinement useNumericNodeIds(Refinement r)
makeNumericIdMap
java.util.Map makeNumericIdMap(ix.icore.domain.ListOfNodeSpec nodes)
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)
expandOrderPair
static LList expandOrderPair(java.lang.Object left,
java.lang.Object right)
ensureList
static LList ensureList(java.lang.Object a)
parseConstraint
public Constraint parseConstraint(java.lang.Object spec)
getConstraintParsers
public MatchTable getConstraintParsers()
addConstraintParsers
protected void addConstraintParsers()
makeObjectClass
ObjectClass makeObjectClass(LList def)
makeSuperNames
ix.util.lisp.ListOfSymbol makeSuperNames(LList names)
makeObjectProperties
ix.icore.domain.ListOfObjectProperty makeObjectProperties(LList props)
makeObjectProperty
ObjectProperty makeObjectProperty(LList spec)
makeAnnotations
java.util.Map makeAnnotations(LList def)
makeMap
java.util.Map makeMap(LList def)
isMapSyntax
boolean isMapSyntax(java.lang.Object obj)
badAnnotation
void badAnnotation(LList kvPair)
doInclude
void doInclude(LList form)
throws java.io.IOException
- Throws:
java.io.IOException
defaultedIncludeURL
java.net.URL defaultedIncludeURL(java.lang.String name)
throws java.net.MalformedURLException
- Throws:
java.net.MalformedURLException