ix.iface.domain
Class LTF_Parser

java.lang.Object
  |
  +--ix.iface.domain.DomainParser
        |
        +--ix.iface.domain.LTF_Parser
All Implemented Interfaces:
EffectSymbols, LTF_SchemaSymbols, ProductSchemaSymbols, SchemaSymbols

public class LTF_Parser
extends DomainParser
implements LTF_SchemaSymbols

A parser for domains described in a Lisp-like syntax.

The parser parses a file of schema definitions to populate a Domain.

In the syntax definitions below, upper-case names are literals and lower-case names are syntactic variables. The literals can be written in either case in domain definitions.

    (DEFINE-PROCESS pattern clause*)
    (DEFINE-ACTION  pattern clause*)
    (DEFINE-SCHEMA  name pattern clause*)
    (DEFINE-PRODUCT (name))

    name ::= symbol | string
    pattern ::= (item*)
    item ::= number | symbol | string | pattern | variable
    variable ::= ?symbol
    clause ::= (NODES node*)
            | (ORDERINGS ordering*) 
            | (EFFECTS effect*)
            | (PROPERTIES property*)
    node ::= (node-number pattern)
    ordering ::= ({node-humber | (node-number*)}*)
    effect ::= (AT when pattern = value)
    when ::= START | FINISH
    value ::= item
    property ::= (string value)
 

See Also:
Domain

Field Summary
(package private) static java.lang.Object defineProductSyntax
           
(package private) static java.lang.Object effectSyntax
           
protected  java.lang.String filename
           
protected  LispReader lin
           
(package private) static Symbol Q_NAME
           
(package private) static Symbol Q_PATTERN
           
(package private) static Symbol Q_VALUE
           
(package private) static Symbol Q_WHEN
           
 
Fields inherited from interface ix.iface.domain.LTF_SchemaSymbols
S_DEFINE_ACTION, S_DEFINE_PROCESS, S_DEFINE_PRODUCT, S_DEFINE_SCHEMA
 
Fields inherited from interface ix.icore.domain.SchemaSymbols
K_ALL, Q_COA, S_ACTION, S_EFFECTS, S_NODES, S_ORDERINGS, S_PROCESS, S_PROPERTIES
 
Fields inherited from interface ix.icore.domain.EffectSymbols
K_COMPLETE, K_DRAFT, S_AT, S_FINISH, S_START
 
Fields inherited from interface ix.icore.domain.ProductSchemaSymbols
K_NAME
 
Constructor Summary
LTF_Parser(java.io.File file)
           
LTF_Parser(java.lang.String filename)
           
 
Method Summary
 LList canonicalProductDescription(LList def)
           
 LList canonicalSchemaDescription(LList def)
           
(package private) static LList ensureList(java.lang.Object a)
           
static LList expandAllOrderings(LList orderings)
          Expands a list of orderings into a list of simple orderings.
static LList expandOrdering(LList ordering)
           
(package private) static LList expandOrderPair(java.lang.Object left, java.lang.Object right)
           
 LList parseBody(LList body)
           
static Effect parseEffect(LList description)
           
 Domain readDomain()
           
 Domain readDomain(Domain dom)
           
 
Methods inherited from class ix.iface.domain.DomainParser
getLibraryDirectory, loadDomain, makeParser, makeParser
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filename

protected java.lang.String filename

lin

protected LispReader lin

effectSyntax

static final java.lang.Object effectSyntax

Q_WHEN

static final Symbol Q_WHEN

Q_PATTERN

static final Symbol Q_PATTERN

Q_VALUE

static final Symbol Q_VALUE

defineProductSyntax

static java.lang.Object defineProductSyntax

Q_NAME

static Symbol Q_NAME
Constructor Detail

LTF_Parser

public LTF_Parser(java.lang.String filename)
           throws java.io.FileNotFoundException

LTF_Parser

public LTF_Parser(java.io.File file)
           throws java.io.FileNotFoundException
Method Detail

readDomain

public Domain readDomain()
Overrides:
readDomain in class DomainParser

readDomain

public Domain readDomain(Domain dom)
Overrides:
readDomain in class DomainParser

canonicalSchemaDescription

public LList canonicalSchemaDescription(LList def)

parseBody

public LList parseBody(LList body)

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 numbers: (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)

parseEffect

public static Effect parseEffect(LList description)

canonicalProductDescription

public LList canonicalProductDescription(LList def)