aminePlatform.engines.prologPlusCG.parser
Class PPCGParser

java.lang.Object
  extended byaminePlatform.util.parserGenerator.ObjectParsing
      extended byaminePlatform.engines.prologPlusCG.parser.PPCGParser
All Implemented Interfaces:
AmineConstants

public class PPCGParser
extends ObjectParsing
implements AmineConstants

Title: PPCGParser

Description: PPCGParser extends ObjectParsing in order to parse a Prolog+CG program.

Copyright: Copyright (c) Adil KABBAJ, 2004-2009


Field Summary
(package private)  int currElem
           
(package private)  byte goalNbre
           
(package private)  int ruleNbre
           
 
Fields inherited from class aminePlatform.util.parserGenerator.ObjectParsing
generateCode, genericCoref, lexicon, txtTokenizer
 
Fields inherited from interface aminePlatform.util.AmineConstants
ANALOGY, B_ASSIGN, B_DSPLY_WT_DELAY, B_DSPLY_WTT_DELAY, B_TRIGGER, B_WTT_DSPLY, BLOCK_BACKWARD_PROPAGATION, BLOCK_FORWARD_PROPAGATION, CANON, CGIF, CGRAPHIC, CHECK_PRECONDITIONS, COMPARE, COMPOSED_GOAL, CONCEPT_TYPE_IDENT, CONTEXT, COVERED_BY, CPLTE_CONTRACT, DEFINITION, EQ_OR_MORE_SPCFQ, EQUAL, EXPAND, FALSE_FOCUS_LIST, FUNCTIONAL, GENERALISE, GENERALIZE, HAVE_AN_INTERSECTION, ID_ADD, ID_DIV, ID_EQ, ID_INF, ID_IS, ID_MESSAGE, ID_MUL, ID_NOT, ID_NULL, ID_OPER_AND, ID_OPER_OR, ID_SUB, ID_SUP, IN_ACTIVATION, IN_MODE, IN_MODE2, INDIVIDUAL, INDIVIDUAL_IDENT, INTEGRATED, IS_CANONIC, KEY_GLOBAL_RULE, LC_ADD, LC_AMINE_BOOLEAN, LC_AMINE_DOUBLE, LC_AMINE_INTEGER, LC_AND, LC_BOOLEAN, LC_CG, LC_CLOSE_BRKT, LC_CLOSE_PARENT, LC_CLOSE_SET, LC_COMMA, LC_COMMA_SEMI, LC_CONCEPT, LC_CONSTRUCTOR, LC_CS, LC_CUT, LC_DIFF, LC_DIV, LC_DOUBLE, LC_DSBL_BKWRD_PRPGTN, LC_DSBL_FRWRD_PRPGTN, LC_EOF, LC_EQ, LC_FOUR_POINTS, LC_IDENTIFIER, LC_IF, LC_INF, LC_INTEGER, LC_INTEROG, LC_IS, LC_JAVA_OBJECT, LC_LEFT_ARROW, LC_LIST, LC_NULL, LC_OPEN_BRKT, LC_OPEN_PARENT, LC_OPEN_SET, LC_OPER_AND, LC_OPER_OR, LC_POINT, LC_RELATION, LC_RGHT_ARROW, LC_SEMI_COMMA, LC_SET, LC_STAR, LC_STATE, LC_STRING, LC_SUB, LC_SUP, LC_TERM, LC_TWO_POINTS, LC_VAR_LIST_CONSTRUCTOR, LC_VARIABLE, LF, MAXIMAL_JOIN, MORE_GENERAL, MORE_SPECIFIC, NOTHING_TO_INTEGRATE, OPERS_WITH_RSLT, OUT_MODE, OUT_MODE2, PARTIAL_CONTRACT, PARTIAL_SUBSUME, PRJCT_OPERS, PROJECT, READ, READ_SENTENCE, RELATION_TYPE_IDENT, S_AND, S_BOOLEAN, S_CG, S_CLOSE_BRKT, S_CLOSE_PARENT, S_CLOSE_SET, S_COMMA, S_CONCEPT, S_CONSTRUCTOR, S_CUT, S_DIFF, S_DOUBLE, S_EOF, S_EQUAL, S_EXPAND, S_FALSE, S_FOUR_POINTS, S_GENERALISE, S_GENERALIZE, S_IDENTIFIER, S_IF, S_INTEGER, S_INTEROG, S_IS, S_IS_CANONIC, S_LEFT_ARROW, S_LIST, S_MAXIMAL_JOIN, S_OPEN_BRKT, S_OPEN_PARENT, S_OPEN_SET, S_POINT, S_RGHT_ARROW, S_SEMI_COMMA, S_SOURCE, S_SPECIALIZE, S_STATE, S_STRING, S_SUBSUME, S_SUBSUME_WITH_RESULT, S_SUPER, S_TARGET, S_TERM, S_THIS, S_TRUE, S_TWO_POINTS, S_UNIFY, S_VARIABLE, SITUATION, SPECIALIZE, STEADY, SUBSUME, SUBSUME_WITH_RSLT, TRIGGER, UNCOMPARABLE, UNIFY, VAR_SUPER, WAIT_ASSIGNMENT, WAIT_END_OF_ASSIGNMENT, WAIT_PRECONDITIONS, WAIT_VALUE
 
Constructor Summary
PPCGParser(Lexicon lexicon)
           
 
Method Summary
 void clearPPCGPrograms()
           
 java.util.ArrayList detVarsQuest()
          get all the variables specified in a request.
 void finalize()
           
 java.util.HashMap getPPCGPrograms()
           
 java.lang.String listAll(java.util.HashMap ppcgProgs)
           
 void load(java.util.ArrayList lstObjFiles)
          load a list of object Prolog+CG files
 java.lang.String paquetToString(java.util.HashMap ppcgProgs, java.lang.String signature)
           
protected  java.lang.Object parseAmineObject()
          This method is the protected version of the method parseAmineObject(String strgObj); it can be used by ObjectParsing's subclasses only since it assumes that some steps have been made and that the environment is already established.
 void parsePPCGPrg(java.io.File sourceFile)
           
 void parsePPCGPrgs(java.io.File[] listOfSourceFiles)
          parsePPCGPrgs considers the compilation of an array of source programs.
 java.util.ArrayList parsePPCGPrgs(javax.swing.text.JTextComponent[] listOfPPCGProgs)
           
 Rule parseQuest(java.lang.String request)
           
 java.util.ArrayList re_parsePPCGPrgs(javax.swing.text.JTextComponent[] listOfPPCGProgs)
           
 void setPPCGPrograms(java.util.HashMap ppcgProgs)
           
 
Methods inherited from class aminePlatform.util.parserGenerator.ObjectParsing
addPseudoCorefs, addPseudoCorefs, conceptToString, conceptToString, deletePseudoDesignators, determineCGForm, determineCGForm, generateDesignator, getBlancsString, getGenerateCode, getLexicon, getTxtTokenizer, getWithDrawingInf, hasSeveralSuper, isDesignator, parseAmineList, parseAmineList, parseAmineObject, parseAmineSet, parseAmineSet, parseCG, parseCG, parseCG, parseCG, parseCG, parseConcept, parseConcept, parseConcept, parseCoreferent, parseDescriptor, parseDesignator, parseExpression, parseMessage, parsePoint, parsePseudoDesignator, parseRelationType, parseSegmentPoints, parseSentence, parseState, parseTerm, parseTerm, parseTerm, setGenerateCode, setLexicon, setTxtTokenizer, setWithDrawingInf
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currElem

int currElem

ruleNbre

int ruleNbre

goalNbre

byte goalNbre
Constructor Detail

PPCGParser

public PPCGParser(Lexicon lexicon)
           throws ParsingException
Method Detail

finalize

public void finalize()
Overrides:
finalize in class ObjectParsing

getPPCGPrograms

public java.util.HashMap getPPCGPrograms()

setPPCGPrograms

public void setPPCGPrograms(java.util.HashMap ppcgProgs)

clearPPCGPrograms

public void clearPPCGPrograms()

load

public void load(java.util.ArrayList lstObjFiles)
load a list of object Prolog+CG files


parsePPCGPrgs

public void parsePPCGPrgs(java.io.File[] listOfSourceFiles)
                   throws java.lang.Exception
parsePPCGPrgs considers the compilation of an array of source programs. In this case, a cumulative compilation is done for all the source programs; all share the same table (HashMap) as internal representation.

Throws:
java.lang.Exception

parsePPCGPrg

public void parsePPCGPrg(java.io.File sourceFile)
                  throws java.lang.Exception
Throws:
java.lang.Exception

re_parsePPCGPrgs

public java.util.ArrayList re_parsePPCGPrgs(javax.swing.text.JTextComponent[] listOfPPCGProgs)
                                     throws java.lang.Exception
Throws:
java.lang.Exception

parsePPCGPrgs

public java.util.ArrayList parsePPCGPrgs(javax.swing.text.JTextComponent[] listOfPPCGProgs)
                                  throws java.lang.Exception
Throws:
java.lang.Exception

parseAmineObject

protected java.lang.Object parseAmineObject()
                                     throws ParsingException
Description copied from class: ObjectParsing
This method is the protected version of the method parseAmineObject(String strgObj); it can be used by ObjectParsing's subclasses only since it assumes that some steps have been made and that the environment is already established. Since AmineList and Concept have the same delimiters; '[' and ']', some look ahead is in order. Even the first element after '[' can't desambiguite the situation in cases where the element can be a concept type. In such a case, the parser should look at the third element. One special case still remains : [Element] where Element can be a concept type. [Element] can be interpreted either as a list of one element or as a concept with concept type only. We adopt the first interpretation. To force the second interpretation, the user should specify a designator (a variable or a pseudo-designator).

Overrides:
parseAmineObject in class ObjectParsing
Returns:
the internal representation (Java Object) of the Amine Object if generateCode is true and null otherwise.
Throws:
ParsingException - if errors occur during parsing

parseQuest

public Rule parseQuest(java.lang.String request)
                throws java.lang.Exception
Throws:
java.lang.Exception

detVarsQuest

public java.util.ArrayList detVarsQuest()
get all the variables specified in a request. This is important in the composition of the response to the request (the response gives the value of all the variables). This is done by a scan over the array of tokens for a variable, but since a variable can occurs many times in the request, it is added in vctIdVarQuest only once.


paquetToString

public java.lang.String paquetToString(java.util.HashMap ppcgProgs,
                                       java.lang.String signature)

listAll

public java.lang.String listAll(java.util.HashMap ppcgProgs)