incubator-imperius-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jnee...@apache.org
Subject svn commit: r610591 - in /incubator/imperius/trunk/modules/imperius-splcore/src/main/antlr: ./ org/ org/apache/ org/apache/imperius/ org/apache/imperius/spl/ org/apache/imperius/spl/parser/ org/apache/imperius/spl/parser/compiler/
Date Wed, 09 Jan 2008 21:54:19 GMT
Author: jneeraj
Date: Wed Jan  9 13:54:09 2008
New Revision: 610591

URL: http://svn.apache.org/viewvc?rev=610591&view=rev
Log:
moved antlr files to a folder structure that matches the generated src 

Added:
    incubator/imperius/trunk/modules/imperius-splcore/src/main/antlr/org/
    incubator/imperius/trunk/modules/imperius-splcore/src/main/antlr/org/apache/
    incubator/imperius/trunk/modules/imperius-splcore/src/main/antlr/org/apache/imperius/
    incubator/imperius/trunk/modules/imperius-splcore/src/main/antlr/org/apache/imperius/spl/
    incubator/imperius/trunk/modules/imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/
    incubator/imperius/trunk/modules/imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/compiler/
    incubator/imperius/trunk/modules/imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/compiler/cimspl.g
    incubator/imperius/trunk/modules/imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/compiler/cimspl.tree.g
Removed:
    incubator/imperius/trunk/modules/imperius-splcore/src/main/antlr/cimspl.g
    incubator/imperius/trunk/modules/imperius-splcore/src/main/antlr/cimspl.tree.g

Added: incubator/imperius/trunk/modules/imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/compiler/cimspl.g
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/modules/imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/compiler/cimspl.g?rev=610591&view=auto
==============================================================================
--- incubator/imperius/trunk/modules/imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/compiler/cimspl.g (added)
+++ incubator/imperius/trunk/modules/imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/compiler/cimspl.g Wed Jan  9 13:54:09 2008
@@ -0,0 +1,534 @@
+/*
+ * Copyright 2007 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// * @author Neeraj Joshi <jneeraj@us.ibm.com>
+ 
+ 
+  header {
+  	/*
+ * Copyright 2007 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+	/**
+	 * @author Neeraj Joshi <jneeraj@us.ibm.com>
+	 *
+	 */
+  package org.apache.imperius.spl.parser.compiler;
+  }
+options {
+    language=Java;
+}
+class SPLParser extends Parser;
+options {
+    exportVocab=cimspl;
+    genHashLines = true;        // include line number information
+    ASTLabelType="org.apache.imperius.spl.parser.compiler.ASTWithLineNumber";
+    buildAST = true;     
+    k = 1;          // uses CommonAST by default
+}
+
+tokens {
+	STRATEGY_DEF; IMPORT_DEF; DECL_DEF; CONSTANT_DEFN; MACRO_DEFN; POLICY_DEF; CONDITION_DEF;
+	POLICY_GRP_DEF; DECISION_DEF; TYPE; ARGUMENTS; ARG_DEF;
+	EXPR; ELIST; METHOD_CALL; UNARY_MINUS; QUALIFIER;
+	PARAMETERS; PARAMETER_DEF; UNARY_PLUS; ARRAY_DECLARATOR; INDEX_OP; COLLECT_OP ;ASSOCIATION;
+        ACTIONBLOCK; COLLECT_CALL ; UNARY_NOT;BASICCOLLECTION_OP;
+
+
+
+ 
+}
+
+
+splpolicy :
+        (importstatement)+ strategystatement declarationstatement (policystatement)+
+;  
+
+importstatement : 
+  //      i:"Import"^ {#i.setType(IMPORT_DEF);} IDENT (DOT! IDENT)* (COMMA! IDENT (DOT! IDENT)*)* (expression)? SEMI! 
+      i:"Import"^ {#i.setType(IMPORT_DEF);}(qualifier)? "Class"!  IDENT (DOT! IDENT)*  (identList)? (expression)?  SEMI!
+; 
+
+qualifier :
+	q:"Qualifier"^  {#q.setType(QUALIFIER);} IDENT
+;
+
+identList :
+	c:COLON^ IDENT (COMMA! IDENT)*
+;
+
+strategystatement :
+        s:"Strategy"^ {#s.setType(STRATEGY_DEF);}("Execute_All_Applicable" | "Execute_First_Applicable")  SEMI!
+;  
+
+declarationstatement :     
+(d:"Declaration"^ {#d.setType(DECL_DEF);} LCURLY! ((constantDefinitions) | (macroDeclarations))* RCURLY! )?
+        ;
+
+constantDefinitions ! :
+		id:IDENT v:varInitializer SEMI!
+		{#constantDefinitions = #(#[CONSTANT_DEFN,"CONSTANT_DEFN"],id,v);}
+               
+;
+
+varInitializer :  
+        ( ASSIGN^ expression )?
+;
+
+  
+macroDeclarations !:
+        "Macro"! LCURLY! m:macrodef RCURLY!
+        {#macroDeclarations = #(#[MACRO_DEFN,"MACRO"],m);}
+;
+macrodef :
+        "Name"^ ASSIGN! id:IDENT SEMI!
+        "type"! ASSIGN! splType SEMI! 
+         argumentList 
+        "procedure"! ASSIGN! expression
+ ;
+argumentList  :
+        ("argument"! ASSIGN! argument (COMMA! argument)* SEMI!)?
+        	{#argumentList = #(#[ARGUMENTS,"ARGUMENTS"],
+									#argumentList);}
+;
+
+argument ! :
+            id:IDENT COLON! c:splType  
+        	{#argument = #(#[ARG_DEF,"ARG_DEF"],  #([TYPE,"TYPE"],c), id);}      
+;
+
+
+policystatement :
+        (policydef | policyGroup)   SEMI!
+;
+
+
+policydef :  
+        p:"Policy"^ {#p.setType(POLICY_DEF);} LCURLY! declarationstatement conditionstatement decision RCURLY! COLON! priority
+;
+
+conditionstatement :
+        (c:"Condition"^ {#c.setType(CONDITION_DEF);} LCURLY! expression RCURLY!)?
+;
+decision :
+        d:"Decision"^ {#d.setType(DECISION_DEF);}  LCURLY! actionBlock RCURLY!
+;
+
+priority :
+        NUM_INT
+; 
+expression :
+        assignmentExpression
+        {#expression = #(#[EXPR,"EXPR"],#expression);}
+;
+
+exprList :  
+        expression (COMMA! expression)*
+        {#exprList = #(#[ELIST,"ELIST"], exprList);}
+;
+
+assignmentExpression : 
+        conditionalExpression
+        (
+                ASSIGN^ assignmentExpression
+        )?    
+;
+
+
+conditionalExpression :
+        logicalOrexpression
+;
+logicalOrexpression : 
+        logicalAndExpression (LOR^ logicalAndExpression)*
+;
+
+logicalAndExpression  :  
+          exclusiveOrExpression (LAND^ exclusiveOrExpression)*
+;
+
+exclusiveOrExpression : 
+          equalityExpression (BXOR^ equalityExpression)*
+;
+
+equalityExpression : 
+        relationalExpression ((NOT_EQUAL^ | EQUAL^) relationalExpression)*
+;
+
+relationalExpression :
+        additiveExpression (( LT^ | GT^ | LE^ | GE^ ) additiveExpression)*
+;
+
+additiveExpression : 
+        multiplicativeExpression ((PLUS^ | MINUS^) multiplicativeExpression)*
+;
+
+
+// multiplication/division (level 2)
+multiplicativeExpression :
+		   
+           unaryExpression ((STAR^ | DIV^ ) unaryExpression)*
+;
+
+unaryExpression :
+          (MINUS^ {#MINUS.setType(UNARY_MINUS);} unaryExpression )| (PLUS^ {#PLUS.setType(UNARY_PLUS);} unaryExpression) | (unaryExpressionNotPlusMinus)
+;
+
+unaryExpressionNotPlusMinus : 
+        (LNOT^ {#LNOT.setType(UNARY_NOT);} unaryExpression )| (primaryExpression)
+;
+
+
+
+primaryExpression :   
+        identPrimary | constant | "true"| "false" | "Self"  | (LPAREN! assignmentExpression RPAREN!)
+;
+
+identPrimary :
+                IDENT^ ( (DOT! IDENT (indexOp | methodCall)?)* | methodCall)
+                | collectOperation
+                | basicCollectionOp  
+                  ;
+                  
+collectOperation :
+                 c:"collect"^ {#c.setType(COLLECT_OP);} collectmethodcall (indexOp (methodOrPropertyOrArrayForCollect)? )?  
+                 ;
+                 
+collectmethodcall :    
+
+LPAREN^ {#LPAREN.setType(COLLECT_CALL); }  paramList RPAREN!
+;          
+
+methodOrPropertyOrArrayForCollect :     DOT! IDENT ( indexOp | methodCall)?
+                                          
+                                        ;
+         
+                
+               
+indexOp : lb:LBRACK^ {#lb.setType(INDEX_OP);} expression RBRACK!
+;
+                  
+basicCollectionOp : lb:LBRACK^ {#lb.setType(BASICCOLLECTION_OP);} exprList RBRACK!
+;                       
+
+methodCall :   lp:LPAREN^ {#lp.setType(METHOD_CALL);} paramList RPAREN!
+                
+                ;            
+
+constant : 
+		// DATE_TIME
+		//|   
+		NUM_INT
+        |   CHAR_LITERAL
+        |   STRING_LITERAL
+        |   NUM_FLOAT
+        |   NUM_LONG
+        |   NUM_DOUBLE
+          
+  
+;
+
+//dateTime : NUM_INT DOT NUM_INT ( (PLUS | MINUS) NUM_INT | COLON NUM_INT)
+       //   ;
+
+paramList : 
+        (exprList)? 
+;
+
+
+actionBlock :
+             actionBlockExpr ( (ARROW^ | LAND^ | LOR^ | BOR^) actionBlockExpr)*
+       ;
+actionBlockExpr :
+                basicActionBlock | LPAREN! actionBlock RPAREN!
+                ;
+                            
+                        
+basicActionBlock :
+                (IDENT | "Set" | "InvokePolicy" ) (DOT! IDENT)? (methodCall) ((EQUAL | NOT_EQUAL | GE | GT | LT | LE) constant)?
+                {#basicActionBlock = #(#[ACTIONBLOCK,"ACTIONBLK"],basicActionBlock );}
+
+;  
+
+policyGroup :
+        p:"PolicyGroup"^ {#p.setType(POLICY_GRP_DEF);} assocName LCURLY! splpolicy RCURLY! COLON! priority
+;
+
+assocName :
+        COLON! IDENT^ LPAREN! IDENT COMMA! IDENT RPAREN!
+         {#assocName = #(#[ASSOCIATION,"ASSOC"], assocName);}
+         ;
+        
+splType :
+	 basicSplTypes (LBRACK RBRACK)?
+      
+        ;
+        
+basicSplTypes :        
+"Sint8" | "Sint16" | "Uint8" | "Uint16" | 
+ "Sint32" | "Sint64" | "Uint32" | "Uint64" |
+    "Real32" | "Real64" | "Boolean" | "Char16"|
+     "String" | "DateTime" | "Reference" 
+;     
+ 
+
+class SPLLexer extends Lexer;
+
+options {
+    exportVocab=cimspl;      // call the vocabulary "Java"
+    testLiterals=false;    // don't automatically test for literals
+    k=4;                   // four characters of lookahead
+    // can't deal with 16 bit chars
+
+    charVocabulary='\u0003'..'\u00FF';
+
+}
+
+// OPERATORS
+
+LPAREN      :   '('     ;
+RPAREN      :   ')'     ;
+LBRACK      :   '['     ;
+RBRACK      :   ']'     ;
+LCURLY      :   '{'     ;
+RCURLY      :   '}'     ;
+COLON       :   ':'     ;
+COMMA       :   ','     ;
+DOT		    :	'.'		;
+ASSIGN      :   '='     ;
+EQUAL       :   "=="    ;
+LNOT        :   '!'     ;
+NOT_EQUAL   :   "!="    ;
+DIV     :   '/'     ;
+PLUS        :   '+'     ;
+MINUS       :   '-'     ;
+//DATE_TIME   : (('0'..'9'|'*') ('0'..'9'|'*')('0'..'9'|'*')('0'..'9'|'*')('0'..'1'|'*')('0'..'9'|'*')('0'..'3'|'*')('0'..'9'|'*')('0'..'6'|'*')('0'..'9'|'*')('0'..'6'|'*')('0'..'9'|'*')('0'..'6'|'*')('0'..'9'|'*')('.')('0'..'9'|'*')('0'..'9'|'*')('0'..'9'|'*')('0'..'9'|'*')('0'..'9'|'*')('0'..'9'|'*')(PLUS|MINUS|':')('0'..'9'|'*')('0'..'9'|'*')('0'..'9'|'*')){_ttype = DATE_TIME;}
+			  
+// ;
+STAR        :   '*'     ;
+GE      :   ">="    ;
+GT      :   ">"     ;
+LE      :   "<="    ;
+LT     :   '<'     ;
+BXOR        :   '^'     ;
+BOR     :   '|'  
+   ;
+LOR     :   "||"    ;
+LAND        :   "&&"    ;
+SEMI        :   ';'     ;
+ARROW   : "->";
+          // Whitespace -- ignored
+WS	:	(	' '
+		|	'\t'
+		|	'\f'
+			// handle newlines
+		|	(	options {generateAmbigWarnings=false;}
+			:	"\r\n"  // Evil DOS
+			|	'\r'    // Macintosh
+			|	'\n'    // Unix (the right way)
+			)
+			{ newline(); }
+		)+
+		{ _ttype = Token.SKIP; }
+	;
+
+// Single-line comments
+SL_COMMENT
+	:	"//"
+		(~('\n'|'\r'))* ('\n'|'\r'('\n')?)?
+		{$setType(Token.SKIP); newline();}
+	;
+
+// multiple-line comments
+ML_COMMENT
+	:	"/*"
+		(	/*	'\r' '\n' can be matched in one alternative or by matching
+				'\r' in one iteration and '\n' in another.  I am trying to
+				handle any flavor of newline that comes in, but the language
+				that allows both "\r\n" and "\r" and "\n" to all be valid
+				newline is ambiguous.  Consequently, the resulting grammar
+				must be ambiguous.  I'm shutting this warning off.
+			 */
+			options {
+				generateAmbigWarnings=false;
+			}
+		:
+			{ LA(2)!='/' }? '*'
+		|	'\r' '\n'		{newline();}
+		|	'\r'			{newline();}
+		|	'\n'			{newline();}
+		|	~('*'|'\n'|'\r')
+		)*
+		"*/"
+		{$setType(Token.SKIP);}
+	;
+
+
+// character literals
+CHAR_LITERAL
+	:	'\'' ( ESC | ~('\''|'\n'|'\r'|'\\') ) '\''
+	;
+
+// string literals
+STRING_LITERAL
+	:	'"' (ESC|~('"'|'\\'|'\n'|'\r'))* '"'
+	;
+
+
+
+// escape sequence -- note that this is protected; it can only be called
+//   from another lexer rule -- it will not ever directly return a token to
+//   the parser
+// There are various ambiguities hushed in this rule.  The optional
+// '0'...'9' digit matches should be matched here rather than letting
+// them go back to STRING_LITERAL to be matched.  ANTLR does the
+// right thing by matching immediately; hence, it's ok to shut off
+// the FOLLOW ambig warnings.
+protected
+ESC
+	:	'\\'
+		(	'n'
+		|	'r'
+		|	't'
+		|	'b'
+		|	'f'
+		|	'"'
+		|	'\''
+		|	'\\'
+		|	('u')+ HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
+		|	'0'..'3'
+			(
+				options {
+					warnWhenFollowAmbig = false;
+				}
+			:	'0'..'7'
+				(
+					options {
+						warnWhenFollowAmbig = false;
+					}
+				:	'0'..'7'
+				)?
+			)?
+		|	'4'..'7'
+			(
+				options {
+					warnWhenFollowAmbig = false;
+				}
+			:	'0'..'7'
+			)?
+		)
+	;
+
+
+// hexadecimal digit (again, note it's protected!)
+protected
+HEX_DIGIT
+	:	('0'..'9'|'A'..'F'|'a'..'f')
+	;
+
+
+// an identifier.  Note that testLiterals is set to true!  This means
+// that after we match the rule, we look in the literals table to see
+// if it's a literal or really an identifer
+IDENT
+	options {testLiterals=true;}
+	:	('a'..'z'|'A'..'Z'|'_'|'$') ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'$'|'/')*
+	;
+                     
+//DATE_TIME
+ //  : ('0'..'9'|STAR) ('0'..'9'|STAR)('0'..'9'|STAR)('0'..'9'|STAR)('0'..'1'|STAR)('0'..'9'|STAR)('0'..'3'|STAR)('0'..'9'|STAR)('0'..'6'|STAR)('0'..'9'|STAR)('0'..'6'|STAR)('0'..'9'|STAR)('0'..'6'|STAR)('0'..'9'|STAR)(DOT)('0'..'9'|STAR)('0'..'9'|STAR)('0'..'9'|STAR)('0'..'9'|STAR)('0'..'9'|STAR)('0'..'9'|STAR)(PLUS|MINUS)('0'..'9'|STAR)('0'..'9'|STAR)('0'..'9'|STAR){_ttype = DATE_TIME;}
+ //   
+//	 ;
+// a numeric literal
+NUM_INT
+	{boolean isDecimal=false; Token t=null;}
+    :   '.' {_ttype = DOT;}
+            (	('0'..'9')+ (EXPONENT)? (f1:FLOAT_SUFFIX {t=f1;})?
+                {
+				if (t != null && t.getText().toUpperCase().indexOf('F')>=0) {
+                	_ttype = NUM_FLOAT;
+				}
+				else {
+                	_ttype = NUM_DOUBLE; // assume double
+				}
+				}
+            )?
+
+	|	(	'0' {isDecimal = true;} // special case for just '0'
+			(	('x'|'X')
+				(											// hex
+					// the 'e'|'E' and float suffix stuff look
+					// like hex digits, hence the (...)+ doesn't
+					// know when to stop: ambig.  ANTLR resolves
+					// it correctly by matching immediately.  It
+					// is therefor ok to hush warning.
+					options {
+						warnWhenFollowAmbig=false;
+					}
+				:	HEX_DIGIT
+				)+
+
+			|	//float or double with leading zero
+				(('0'..'9')+ ('.'|EXPONENT|FLOAT_SUFFIX)) => ('0'..'9')+
+
+			|	('0'..'7')+									// octal
+			)?
+		|	('1'..'9') ('0'..'9')*  {isDecimal=true;}		// non-zero decimal
+		)
+		(	('l'|'L') { _ttype = NUM_LONG; }
+
+		// only check to see if it's a float if looks like decimal so far
+		|	{isDecimal}?
+            (   '.' ('0'..'9')* (EXPONENT)? (f2:FLOAT_SUFFIX {t=f2;})?
+            |   EXPONENT (f3:FLOAT_SUFFIX {t=f3;})?
+            |   f4:FLOAT_SUFFIX {t=f4;}
+            )
+            {
+			if (t != null && t.getText().toUpperCase() .indexOf('F') >= 0) {
+                _ttype = NUM_FLOAT;
+			}
+            else {
+	           	_ttype = NUM_DOUBLE; // assume double
+			}
+			}
+        )?
+	;
+
+
+// a couple protected methods to assist in matching floating point numbers
+protected
+EXPONENT
+	:	('e'|'E') ('+'|'-')? ('0'..'9')+
+	;
+
+
+protected
+FLOAT_SUFFIX
+	:	'f'|'F'|'d'|'D'
+	;
+
+

Added: incubator/imperius/trunk/modules/imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/compiler/cimspl.tree.g
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/modules/imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/compiler/cimspl.tree.g?rev=610591&view=auto
==============================================================================
--- incubator/imperius/trunk/modules/imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/compiler/cimspl.tree.g (added)
+++ incubator/imperius/trunk/modules/imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/compiler/cimspl.tree.g Wed Jan  9 13:54:09 2008
@@ -0,0 +1,1455 @@
+/*
+ * Copyright 2007 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// * @author Neeraj Joshi <jneeraj@us.ibm.com>
+ 
+ 
+  header {
+  	/*
+ * Copyright 2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+	/**
+	 * @author Neeraj Joshi <jneeraj@us.ibm.com>
+	 *
+	 */
+  package org.apache.imperius.spl.parser.compiler;
+ 
+  }
+
+
+
+options {
+    language=Java;
+}
+{
+import java.util.*;
+import java.io.*;
+import org.apache.imperius.spl.parser.statements.impl.*;
+import org.apache.imperius.spl.parser.statements.*;
+import org.apache.imperius.spl.parser.statements.impl.*;
+import org.apache.imperius.spl.parser.factory.*;
+import org.apache.imperius.spl.parser.expressions.*;
+import org.apache.imperius.spl.parser.expressions.impl.*;
+import org.apache.imperius.spl.parser.util.*;
+import org.apache.imperius.spl.parser.compiler.IdentPrimaryTuple;
+import org.apache.imperius.spl.parser.compiler.symboltable.*;
+import org.apache.imperius.spl.parser.statements.PolicyStatement;
+import org.apache.imperius.spl.parser.exceptions.*;
+import org.apache.imperius.spl.external.*;
+import org.apache.imperius.util.SPLLogger;
+import org.apache.imperius.spl.parser.expression.primary.*;
+import org.apache.imperius.spl.parser.exceptions.*;
+import java.util.logging.Logger;
+import java.util.logging.Level;
+
+
+
+
+
+
+}
+
+class SPLTreeParser extends TreeParser;
+
+options {
+    importVocab=cimspl;
+     ASTLabelType="org.apache.imperius.spl.parser.compiler.ASTWithLineNumber";
+    genHashLines = true;        // include line number information
+    
+
+
+}
+
+
+{
+SPLSymbolTable globalSymbolTable = new SPLSymbolTable();
+private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    
+SPLSymbolTable currSymbolTable = globalSymbolTable;
+String currAnchor = "";
+DataCollector dataCollector = null;
+
+//ExpressionFactory expressionFactory = new ExpressionFactory();
+}
+
+splpolicy[DataCollector dc, SPLSymbolTable currentSymTab] returns [SPLPolicy cp = null]
+{
+		dataCollector = dc;
+        SPLSymbolTable symTab = new SPLSymbolTable(currentSymTab,SPLSymbolTable.POLICYGROUP);
+        symTab.setDataCollector(dataCollector);
+        
+        currSymbolTable = symTab;
+        List importStatementList  = new ArrayList();
+        ImportStatement i = null;
+        PolicyStatement p = null;
+        ArrayList pStmtList = new ArrayList();
+        DeclarationStatement d = null;
+        StrategyStatement s = null;
+		
+}
+:
+        (i=importstatement[symTab]{importStatementList.add(i);})+ s=strategystatement (d=declarationstatement[symTab])? (p=policystatement[symTab] {pStmtList.add(p);} )+
+        { 
+                cp = new SPLPolicy(importStatementList,s,d,pStmtList,symTab);
+                if(logger.isLoggable(Level.FINE))
+                	logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: SPLPolicy Created");
+            
+          
+        }
+        ;  
+//i:"Import"^ {#i.setType(IMPORT_DEF);} IDENT (DOT! IDENT)* (identList)? (expression)? SEMI! 
+importstatement[SPLSymbolTable symTab] returns [ImportStatement i = null]
+{
+   Expression e = null;
+   String qual = null;
+   StringBuffer className = new StringBuffer();
+   List instanceInfoList = new ArrayList();
+
+}
+: //(03-04-2007) PB: set namespace before set anchor as datacollector needs it in order to populate anchor elements
+  #(IMPORT_DEF (qual = qualifier)? i1:IDENT {className.append(i1.getText());}(i2:IDENT {className.append("." + i2.getText());})*
+  		(instanceInfoList = identList)? 
+  	{ 
+	  	try
+	  	{
+	  		//System.out.println("class name, qual = "+className.toString()+" , "+qual);
+	  		symTab.addAnchor(className.toString(), qual, instanceInfoList);
+	  	}	
+	  	catch (SPLException exep)
+	  	{ 
+	  			ASTWithLineNumber q = (ASTWithLineNumber)i1;
+	  			//System.out.println(exep.getMessage() + "at line" + q.getLine()); 
+	  			
+	  	}
+  	}
+  	(e=expression[symTab])?)
+  	{
+//  currSymbolTable.setAnchor(i4.getText());
+	  i = new ImportStatement(className.toString(),instanceInfoList,e,symTab); 
+	  //if(logger.isLoggable(Level.FINE))
+	  //logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: ImportStatement Created");
+            
+  
+  	}
+                  
+
+; 
+
+qualifier returns [String qualifier = null]
+:
+#(QUALIFIER c:IDENT { qualifier = c.getText(); } )
+;	
+
+identList returns [List instanceInfoList = null] 
+{
+   InstanceInfo ii = null;	
+   instanceInfoList = new ArrayList();
+}	
+:
+#(COLON cl:IDENT { ii = new InstanceInfo(cl.getText(),new Object());instanceInfoList.add(ii);} 
+  		(c2:IDENT { ii = new InstanceInfo(c2.getText(), new Object()); instanceInfoList.add(ii);} )*)
+  		
+  		;
+
+strategystatement returns [StrategyStatement s = null] :
+                #(STRATEGY_DEF (
+                "Execute_All_Applicable" 
+                {
+                   	s = new StrategyStatement("Execute_All_Applicable");
+                   	if(logger.isLoggable(Level.FINE))
+  				   		logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: StrategyStatement Created");
+   
+                }
+                | 
+                "Execute_First_Applicable"
+                 {
+                   	s = new StrategyStatement("Execute_First_Applicable");
+                   	if(logger.isLoggable(Level.FINE))
+  				   		logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: StrategyStatement Created");
+   
+                 }
+                
+                ))
+                
+                        
+;  
+
+declarationstatement[SPLSymbolTable symTab] returns [DeclarationStatement d = null] 
+{
+        ArrayList cList = new ArrayList();
+        ArrayList mList = new ArrayList();
+        MacroDefinition m = null;
+        ConstantDefinition c = null;
+}
+
+:     
+                #(DECL_DEF ((c = constantDefinitions[symTab] {cList.add(c);} ) | (m=macroDeclarations[symTab] {mList.add(m);} ))* )
+                {
+                        d = new DeclarationStatement(cList,mList,symTab);
+                        if(logger.isLoggable(Level.FINE))
+  				   			logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: DeclarationStatement Created");
+   
+                }
+
+        ; 
+
+constantDefinitions[SPLSymbolTable symTab]  returns [ConstantDefinition cd = null ]
+{
+        Expression v = null;
+}
+:
+                 #(t:CONSTANT_DEFN id:IDENT v=varInitializer[symTab])
+                  {
+                 	//currSymbolTable.insertVariableSymbol(id.getText(),null,null);
+                 	try
+                 	{
+                 		//System.out.println("id.getText() "+id.getText() +" v.getType() "+v.getType()+ " v "+v.toString() );
+                 		
+                 		symTab.insertVariableSymbol(id.getText(),v.getType(),false,false); 
+                  		cd = new ConstantDefinition(id.getText(),v,symTab);
+                  		if(logger.isLoggable(Level.FINE))
+  				   			logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: ConstantDefinition Created "+id.getText());
+   
+                 	}
+                 	catch(SPLException excep)
+					{
+						ASTWithLineNumber q = (ASTWithLineNumber)t;
+						logger.severe(excep.getMessage());
+						logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception inserting symbol "+id.getText() +" at line "+q.getLine());
+						//System.out.println(excep.getMessage());
+						//System.out.println("TreeParser::Exception inserting symbol "+id.getText() +" at line "+q.getLine());
+						System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+						throw new RecognitionException(excep.getMessage());
+					}
+                  
+                  } 
+	                      
+;
+
+varInitializer[SPLSymbolTable symTab] returns [Expression v = null]
+{
+	
+}
+
+  :
+                #(ASSIGN v=expression[symTab])
+{
+		
+}	                
+                
+        ;
+
+
+macroDeclarations[SPLSymbolTable symTab] returns [MacroDefinition m = null]:
+                #(MACRO_DEFN m=macrodef[symTab])
+      ;
+macrodef[SPLSymbolTable symTab] returns [MacroDefinition m = null] 
+{
+        ArrayList a=new ArrayList();
+        Expression e = null;
+        String arr = "";
+		String typestr="";
+		boolean isArr=false;
+        SPLSymbolTable macroSymTab = new SPLSymbolTable(symTab,2);
+        
+        macroSymTab.setSymbolTableType(SPLSymbolTable.MACRO);
+        symTab.addChildSymbolTable(macroSymTab);
+        
+                
+}
+:
+                #("Name" id:IDENT arr=splType  a=argumentList[macroSymTab] e=expression[macroSymTab])
+                {
+                       // currSymbolTable.insertMethodSymbol(id.getText(),c.getText(),a);
+                  //System.out.println("treeparser c= "+c.getText());
+                  if(logger.isLoggable(Level.FINE))
+  				   		logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: MacroDefinition type "+arr);
+   
+                  if(arr!=null)
+                	{
+	                	if(arr.indexOf("[") != -1)
+	                	{
+	                		typestr=arr.substring(0,arr.indexOf("["));
+	                		if(logger.isLoggable(Level.FINE))
+  				   				logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: MacroDefinition typestr "+typestr);
+	                		isArr=true;
+	                		if(logger.isLoggable(Level.FINE))
+  				   				logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: macro isArray = "+isArr);
+   
+	                	}
+	                	else
+	                	{
+	                		typestr=arr;
+	                	}
+                	}
+                	else
+                	{
+                		logger.severe(Thread.currentThread().getName()+" "+" arr string is null in macrodef ");
+                	}
+                	
+                  //int type = TypeConstants.getActualType(typestr);
+                  
+                  	
+                  
+                  	
+                  	
+                  
+                  try
+                  {
+                  	m = new MacroDefinition(id.getText(),typestr,isArr,a,e,macroSymTab,symTab); 
+                  	//System.out.println("MacroDefinition : "+id.getText()+" "+typestr);
+                  	
+                    if(logger.isLoggable(Level.FINE))
+  				   		logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: MacroDefinition Created "+id.getText());
+   
+                  	symTab.insertMacroSymbol(id.getText(),typestr,isArr,a,m);
+                  	//System.out.println("inserted MacroSymbol into Symbol Table : "+id.getText());
+                  	if(logger.isLoggable(Level.FINE))
+  				   		logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: MacroDefinition inserted into SymbolTable "+id.getText());
+   
+                  }
+                  catch(SPLException excep)
+                  {
+                  		ASTWithLineNumber q = (ASTWithLineNumber)id;
+						logger.severe(excep.getMessage());
+						logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception inserting symbol "+id.getText() +" at line "+q.getLine());
+						//System.out.println(excep.getMessage());
+						//System.out.println("TreeParser::Exception inserting symbol "+id.getText() +" at line "+q.getLine());
+						System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+						throw new RecognitionException(excep.getMessage());
+						
+                  }		
+                 
+                  
+                }
+       ; 
+argumentList[SPLSymbolTable symTab]  returns [ArrayList argTypes=new ArrayList()] 
+{ Argument at = null;
+}
+ :
+                #(ARGUMENTS (at=argument[symTab] {argTypes.add(at);})* )
+       ;
+
+argument[SPLSymbolTable symTab] returns [Argument tp = null]
+{ 
+	String arr = "";
+	String typestr="";
+	boolean isArr=false;
+}
+ :
+                #(ARG_DEF #(TYPE arr=splType ) i:IDENT )
+                {
+                	if(logger.isLoggable(Level.FINE))
+  				   			logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: macro arr = "+arr);
+   
+                	if(arr!=null)
+                	{
+	                	if(arr.indexOf("[") != -1)
+	                	{
+	                		typestr=arr.substring(0,arr.indexOf("["));
+	                		if(logger.isLoggable(Level.FINE))
+  				   				logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: MacroDefinition typestr "+typestr);
+	                		isArr=true;
+	                		if(logger.isLoggable(Level.FINE))
+  				   				logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: macro isArray = "+isArr);
+   
+	                	}	
+	                	else
+	                	{
+	                		typestr=arr;
+	                	}
+                	}
+                	else
+                	{
+                		logger.severe(Thread.currentThread().getName()+" "+" arr string is null in argument ");
+                	}
+                		
+                		
+                		try
+                		{
+                			int type = TypeConstants.getActualType(typestr);
+	                		
+                	    	symTab.insertVariableSymbol(i.getText(),type,null,isArr,false,false);
+                	    	if(logger.isLoggable(Level.FINE))
+  				   				logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: Variable inserted into SymbolTable "+i.getText());
+   
+                        	tp = new ArgumentImpl(typestr,i.getText(),isArr,null); 
+                        	if(logger.isLoggable(Level.FINE))
+  				   				logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: Argument created");
+   
+                		}
+                		catch(SPLException excep)
+                		{
+                			ASTWithLineNumber q = (ASTWithLineNumber)i;
+							logger.severe(excep.getMessage());
+							logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception inserting symbol "+i.getText() +" at line "+q.getLine());
+							//System.out.println(excep.getMessage());
+							//System.out.println("TreeParser::Exception inserting symbol "+i.getText() +" at line "+q.getLine());
+							System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+							throw new RecognitionException(excep.getMessage());
+                		}		
+                }
+           
+;
+
+
+policystatement[SPLSymbolTable symTab] returns [PolicyStatement p = null]
+:
+                ( p = policydef[symTab] | p =  policyGroup[symTab] )
+        
+;
+
+
+policydef[SPLSymbolTable symTab]  returns [PolicyDefinition pd = null]
+     { 
+        SPLSymbolTable lclSymTab = new SPLSymbolTable(symTab);
+        symTab.addChildSymbolTable(lclSymTab);
+     //   currSymbolTable = symTab;
+        DeclarationStatement d = null;
+        Expression exp = null;
+        ActionBlock dec = null;
+        
+     }   
+: 
+        #(POLICY_DEF (d = declarationstatement[lclSymTab])? (exp = conditionstatement[lclSymTab])? dec = decision[lclSymTab] p:priority) 
+        {   
+               // currSymbolTable = currSymbolTable.getParentSymbolTable(); 
+                pd = new PolicyDefinition(d,exp,dec,p.getText(),lclSymTab);
+                if(logger.isLoggable(Level.FINE))
+  				   logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: PolicyDefinition Created");
+   
+        
+        
+        } 
+
+      
+;
+
+conditionstatement[SPLSymbolTable symTab] returns [Expression exp = null]:
+        #(CONDITION_DEF exp=expression[symTab])
+        {/*//System.out.println("cimspl.tree.g condition statement "+exp);*/}
+    
+;
+decision[SPLSymbolTable symTab] returns [ActionBlock ab=null]:
+
+        #(DECISION_DEF ab=actionBlock[symTab])
+    
+;
+
+priority :
+        NUM_INT
+; 
+expression[SPLSymbolTable symTab] returns [Expression exp=null]:
+        #(EXPR exp=expr[symTab])
+     
+;
+
+expr[SPLSymbolTable symTab] returns [Expression e=null] 
+{
+        Expression e1=null;
+        Expression e2=null;
+
+}
+
+:
+		#(t:ASSIGN e1=expr[symTab] e2=expr[symTab])
+        { 
+        	try 
+        	{ 
+        		e = ExpressionFactory.createExpression(e1,e2,ASSIGN,symTab); 
+        		if(logger.isLoggable(Level.FINE))
+  					logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+e.toString());
+   
+        	}
+        	catch (SPLException excep) 
+        	{
+        		ASTWithLineNumber q = (ASTWithLineNumber)t;
+				logger.severe(excep.getMessage());
+				logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+				//System.out.println(excep.getMessage());
+				//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+				System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+				throw new RecognitionException(excep.getMessage());
+        	}
+        }
+        |#(t1:LOR e1=expr[symTab] e2=expr[symTab]) 
+	    { 
+	    	try 
+	    	{ 
+	    		e = ExpressionFactory.createExpression(e1,e2,LOR,symTab);
+	    		if(logger.isLoggable(Level.FINE))
+  					logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+e.toString());
+   
+	    	}
+	    	catch (SPLException excep) 
+	    	{
+	    		ASTWithLineNumber q = (ASTWithLineNumber)t1;
+				logger.severe(excep.getMessage());
+				logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+				//System.out.println(excep.getMessage());
+				//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+				//throw new RecognitionException(excep.getMessage());
+				System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+				throw new RecognitionException(excep.getMessage());
+			}
+	   }
+       | #(t2:LAND e1=expr[symTab] e2=expr[symTab]) 
+        { 
+        	try 
+        	{
+        		e = ExpressionFactory.createExpression(e1,e2,LAND,symTab);
+        		if(logger.isLoggable(Level.FINE))
+  					logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+e.toString());
+   
+        	}
+        	catch (SPLException excep) 
+        	{
+        		ASTWithLineNumber q = (ASTWithLineNumber)t2;
+				logger.severe(excep.getMessage());
+				logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+				//System.out.println(excep.getMessage());
+				//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+				//throw new RecognitionException(excep.getMessage());
+				System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+				throw new RecognitionException(excep.getMessage());			
+        	}
+       }
+       |#(t3:BXOR e1=expr[symTab] e2=expr[symTab]) 
+       { 
+	       	try 
+	       	{
+	       		e = ExpressionFactory.createExpression(e1,e2,BXOR,symTab);
+	       		if(logger.isLoggable(Level.FINE))
+  					logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+e.toString());
+   
+	       	}
+	       	catch (SPLException excep) 
+	       	{
+	       		ASTWithLineNumber q = (ASTWithLineNumber)t3;
+				logger.severe(excep.getMessage());
+				logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+				//System.out.println(excep.getMessage());
+				//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+				System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+				throw new RecognitionException(excep.getMessage());			
+	       	}
+       }
+       |#(t4:NOT_EQUAL e1=expr[symTab] e2=expr[symTab])
+       { 
+	       	try 
+	       	{
+	       		e = ExpressionFactory.createExpression(e1,e2,NOT_EQUAL,symTab);
+	       		if(logger.isLoggable(Level.FINE))
+  					logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+e.toString());
+   
+	       	}
+	       	catch (SPLException excep) 
+	       	{
+	       		ASTWithLineNumber q = (ASTWithLineNumber)t4;
+				logger.severe(excep.getMessage());
+				logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+				//System.out.println(excep.getMessage());
+				//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+				System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+				throw new RecognitionException(excep.getMessage());			
+	       	}
+       }
+       |#(t5:EQUAL e1=expr[symTab] e2=expr[symTab]) 
+       { 
+	       	try 
+	       	{
+	       		e = ExpressionFactory.createExpression(e1,e2,EQUAL,symTab);
+	       		if(logger.isLoggable(Level.FINE))
+  					logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+e.toString());
+   
+	       		
+	       	}
+	       	catch (SPLException excep) 
+	       	{
+	       		ASTWithLineNumber q = (ASTWithLineNumber)t5;
+	       		//System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+				logger.severe(excep.getMessage());
+				logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+				//System.out.println(excep.getMessage());
+				System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+				throw new RecognitionException(excep.getMessage());			
+			}
+       }
+       |#(t6:LT e1=expr[symTab] e2=expr[symTab])
+       { 
+	       	try 
+	       	{
+	       		e = ExpressionFactory.createExpression(e1,e2,LT,symTab);
+	       		if(logger.isLoggable(Level.FINE))
+  					logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+e.toString());
+   
+	       		
+			}
+			catch (SPLException excep) 
+			{
+				ASTWithLineNumber q = (ASTWithLineNumber)t6;
+				//System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+				logger.severe(excep.getMessage());
+				logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+				//System.out.println(excep.getMessage());
+				System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+				throw new RecognitionException(excep.getMessage());				
+			}
+	   }
+       |#(t7:GT e1=expr[symTab] e2=expr[symTab]) 
+       { 
+	       	try 
+	       	{
+	       		e = ExpressionFactory.createExpression(e1,e2,GT,symTab);
+	       		if(logger.isLoggable(Level.FINE))
+  					logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+e.toString());
+   
+	       	}
+	       	catch (SPLException excep) 
+	       	{
+	       		ASTWithLineNumber q = (ASTWithLineNumber)t7;
+	       		//System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+				logger.severe(excep.getMessage());
+				logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+				//System.out.println(excep.getMessage());
+				System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+				throw new RecognitionException(excep.getMessage());				
+	       	}
+       }
+       |#(t8:LE e1=expr[symTab] e2=expr[symTab])  
+       {
+	       	try 
+	       	{
+	       		e = ExpressionFactory.createExpression(e1,e2,LE,symTab);
+	       		if(logger.isLoggable(Level.FINE))
+  					logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+e.toString());
+   
+	       	}
+	       	catch (SPLException excep) 
+	       	{
+	       		ASTWithLineNumber q = (ASTWithLineNumber)t8;
+	       		//System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+				logger.severe(excep.getMessage());
+				logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+				//System.out.println(excep.getMessage());
+				System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+				throw new RecognitionException(excep.getMessage());			
+	       	}
+       }
+       |#(t9:GE e1=expr[symTab] e2=expr[symTab])   
+       { 
+	       	try 
+	       	{
+	       		e = ExpressionFactory.createExpression(e1,e2,GE,symTab);
+	       		if(logger.isLoggable(Level.FINE))
+  					logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+e.toString());
+   
+	       	}
+	       	catch (SPLException excep) 
+	       	{
+	       		ASTWithLineNumber q = (ASTWithLineNumber)t9;
+				logger.severe(excep.getMessage());
+				logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+				//System.out.println(excep.getMessage());
+				//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+				System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+				throw new RecognitionException(excep.getMessage());			
+	       	}
+       }
+       |#(t10:PLUS e1=expr[symTab] e2=expr[symTab])  
+       { 
+	       	try 
+	       	{
+	       		e = ExpressionFactory.createExpression(e1,e2,PLUS,symTab);
+	       		if(logger.isLoggable(Level.FINE))
+  					logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+e.toString());
+   
+	       	} 
+	       	catch (SPLException excep) 
+	       	{
+	       		ASTWithLineNumber q = (ASTWithLineNumber)t10;
+				logger.severe(excep.getMessage());
+				logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+				//System.out.println(excep.getMessage());
+				//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+				System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+				throw new RecognitionException(excep.getMessage());			
+	       	}
+       }
+       |#(t11:MINUS e1=expr[symTab] e2=expr[symTab]) 
+       { 
+	       	try 
+	       	{
+	       		e = ExpressionFactory.createExpression(e1,e2,MINUS,symTab);
+	       		if(logger.isLoggable(Level.FINE))
+  					logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+e.toString());
+   
+	       	}
+	       	catch (SPLException excep) 
+	       	{
+	       		ASTWithLineNumber q = (ASTWithLineNumber)t11;
+				logger.severe(excep.getMessage());
+				logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+				//System.out.println(excep.getMessage());
+				//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+				System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+				throw new RecognitionException(excep.getMessage());			
+	       	}
+       }
+       |#(t12:DIV e1=expr[symTab] e2=expr[symTab])   
+       { 
+	       	try 
+	       	{
+	       		e = ExpressionFactory.createExpression(e1,e2,DIV,symTab);
+	       		if(logger.isLoggable(Level.FINE))
+  					logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+e.toString());
+   
+	       	} 
+	       	catch (SPLException excep) 
+	       	{
+	       		ASTWithLineNumber q = (ASTWithLineNumber)t12;
+				logger.severe(excep.getMessage());
+				logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+				//System.out.println(excep.getMessage());
+				//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+				System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+				throw new RecognitionException(excep.getMessage());			
+	       	}
+       }
+       |#(t13:STAR e1=expr[symTab] e2=expr[symTab])  
+       { 
+	       	try 
+	       	{
+	       		e = ExpressionFactory.createExpression(e1,e2,STAR,symTab);
+	       		if(logger.isLoggable(Level.FINE))
+  					logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+e.toString());
+   
+	       	}
+	       	catch (SPLException excep) 
+	       	{
+	       		ASTWithLineNumber q = (ASTWithLineNumber)t13;
+				logger.severe(excep.getMessage());
+				logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+				//System.out.println(excep.getMessage());
+				//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+				System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+				throw new RecognitionException(excep.getMessage());			
+	       	}
+       }
+       |#(t14:UNARY_MINUS e1=expr[symTab]) 
+       { 
+	       	try 
+	       	{
+	       		e = ExpressionFactory.createExpression(e1,UNARY_MINUS,symTab);
+	       		if(logger.isLoggable(Level.FINE))
+  					logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+e.toString());
+   
+	       	} 
+	       	catch (SPLException excep) 
+	       	{
+	       		ASTWithLineNumber q = (ASTWithLineNumber)t14;
+				logger.severe(excep.getMessage());
+				logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+				//System.out.println(excep.getMessage());
+				//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+				//throw new RecognitionException("");
+				System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+				throw new RecognitionException(excep.getMessage());			
+	       	}
+       }
+       |#(t15:UNARY_PLUS e1=expr[symTab])   
+       { 
+	       	try 
+	       	{
+	       		e = ExpressionFactory.createExpression(e1,UNARY_PLUS,symTab);
+	       		if(logger.isLoggable(Level.FINE))
+  					logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+e.toString());
+   
+	       	}
+	       	catch (SPLException excep) 
+	       	{
+	       		ASTWithLineNumber q = (ASTWithLineNumber)t15;
+				logger.severe(excep.getMessage());
+				logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+				//System.out.println(excep.getMessage());
+				//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+				System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+				throw new RecognitionException(excep.getMessage());				
+	       	}
+       }
+       |#(t16:UNARY_NOT e1=expr[symTab])
+       { 
+	       	try 
+	       	{
+	       		e = ExpressionFactory.createExpression(e1,UNARY_NOT,symTab);
+	       		if(logger.isLoggable(Level.FINE))
+  					logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+e.toString());
+   
+	       	}
+	       	catch (SPLException excep) 
+	       	{
+	       		ASTWithLineNumber q = (ASTWithLineNumber)t16;
+				logger.severe(excep.getMessage());
+				logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+				//System.out.println(excep.getMessage());
+				//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+				System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+				throw new RecognitionException(excep.getMessage());			
+	       	}
+       }
+       |e=primaryExpression[symTab] 
+       {
+       	
+       } 
+ ;  
+  
+       
+primaryExpression[SPLSymbolTable symTab] returns [Expression e = null]
+        : 
+            
+           
+           t:"true"  
+          { 
+	          	try 
+	          	{ 
+	          		e = ExpressionFactory.createExpression(t.getText(),TypeConstants.booleanType);
+	          		if(logger.isLoggable(Level.FINE))
+  						logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+e.toString());
+   
+	          	}
+	          	catch (SPLException excep) 
+	          	{
+	          		ASTWithLineNumber q = (ASTWithLineNumber)t;
+					logger.severe(excep.getMessage());
+					logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+					//System.out.println(excep.getMessage());
+					//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+					System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+					throw new RecognitionException(excep.getMessage());				
+	          	}
+          }
+          | f:"false" 
+          { 
+	          	try 
+	          	{
+	          		e = ExpressionFactory.createExpression(f.getText(),TypeConstants.booleanType);
+	          		if(logger.isLoggable(Level.FINE))
+  						logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+e.toString());
+   
+	          	}catch (SPLException excep) 
+	          	{
+	          		ASTWithLineNumber q = (ASTWithLineNumber)f;
+					logger.severe(excep.getMessage());
+					logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+					//System.out.println(excep.getMessage());
+					//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+					System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+					throw new RecognitionException(excep.getMessage());				
+	          	}
+          }
+          | s:"Self"  
+          { 
+          	try 
+	          	{
+          		//System.out.println("Self expression");
+          		e = ExpressionFactory.createSelfExpression(symTab);
+          		if(logger.isLoggable(Level.FINE))
+  					logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+e.toString());
+   				}catch (SPLException excep) 
+	          	{
+	          		ASTWithLineNumber q = (ASTWithLineNumber)s;
+					logger.severe(excep.getMessage());
+					logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+					//System.out.println(excep.getMessage());
+					//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+					System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+					throw new RecognitionException(excep.getMessage());				
+	          	}
+          }
+	      | e = constant 
+	      {
+	      	
+	      }
+          | e = identPrimary[symTab]  
+          { 
+          	//System.out.println("identPrimary");
+          }
+                    ; 
+          
+identPrimary[SPLSymbolTable symTab] returns [Expression e=null]
+{
+    Expression arrexp = null;
+    List paramList = new ArrayList();
+    String secondId = "";
+    boolean isMethod = false;
+    boolean isBuiltInMethod = false;
+    List identTupleList = new ArrayList();
+    IdentPrimaryTuple tp = null;
+    SPLSymbolTable sTab = symTab;
+}
+
+:
+          e = collectExpr[symTab]
+        |
+         #( i1:IDENT
+         	 (
+	         	#(m2:METHOD_CALL 
+         		 	(paramList = exprList[symTab])?
+         		  )
+         		|  
+         		(
+         		   
+         		  i2:IDENT { secondId = i2.getText(); } 
+         	  	   ( 
+         		      arrexp=arrayIndex[symTab]  
+         			   | 
+         			  #( m:METHOD_CALL  
+         				(paramList = exprList[symTab])?  
+         			   ) 
+         			)?  
+         			{ 
+         				if(m != null)
+         					isMethod = true;
+         				sTab = new SPLSymbolTable();
+         				tp = new IdentPrimaryTuple(arrexp, paramList, secondId, isMethod,sTab);
+         				identTupleList.add(tp);
+         				
+  
+         			    
+         			}
+         		)*
+         	)	
+         		 
+          )       
+         {
+            if(m2!=null)
+            {
+                isBuiltInMethod = true;
+               //System.out.println("is isBuiltInMethod=true");
+            }
+            // do the symbol validation here
+            try
+            {
+            	if(!isBuiltInMethod)
+            	{
+            		e = ExpressionFactory.createExpression(i1.getText(),identTupleList,isBuiltInMethod,symTab);
+	            	if(logger.isLoggable(Level.FINE))
+	            	{
+  						logger.fine(Thread.currentThread().getName()+
+  							" CIMSPLTreeParser:: expression created "+e.toString());
+	            	}		
+            	}
+            	else
+            	{
+            		e = ExpressionFactory.createExpression(i1.getText(),paramList,isBuiltInMethod,symTab);
+            		if(logger.isLoggable(Level.FINE))
+            		{
+  						logger.fine(Thread.currentThread().getName()+
+  							" CIMSPLTreeParser:: expression created "+e.toString());
+            		}		
+            	}			
+   
+            }
+            catch(SPLException excep)
+            {
+            	ASTWithLineNumber q = (ASTWithLineNumber)i1;
+				logger.severe(excep.getMessage());
+				logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+				//System.out.println(excep.getMessage());
+				//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+				System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+				throw new RecognitionException(excep.getMessage());				
+            }
+              
+            		
+         } 
+        |  e = basicCollectExpr[symTab]
+         
+        ;
+
+collectExpr[SPLSymbolTable symTab]  returns [Expression expr=null]
+{
+  ArrayList paramList = new ArrayList();
+  Expression arrExp = null;
+  Expression postExpr = null;
+  SPLSymbolTable collectSymbolTable = new SPLSymbolTable();
+  collectSymbolTable.setSymbolTableType(SPLSymbolTable.COLLECT);
+  collectSymbolTable.setParentSymbolTable(symTab) ;
+  collectSymbolTable.setDefaultQualifier(symTab.getDefaultQualifier());
+  
+
+}  
+        :
+       #(c:COLLECT_OP #(COLLECT_CALL paramList = exprList[collectSymbolTable]) (postExpr = methodPropArrForCollect[symTab,collectSymbolTable])?  )
+{
+	try
+	{
+		//System.out.println("createCollectExpression"); 
+        expr = ExpressionFactory.createCollectExpression(paramList,postExpr,collectSymbolTable);
+        if(logger.isLoggable(Level.FINE))
+  			logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+expr.toString());
+   
+	}
+	catch (SPLException excep)  
+	{
+            ASTWithLineNumber q = (ASTWithLineNumber)c;
+			logger.severe(excep.getMessage()); 
+			logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+			//System.out.println(excep.getMessage());
+			//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+			System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+			throw new RecognitionException(excep.getMessage());			
+	}	    
+}   
+;
+
+methodPropArrForCollect[SPLSymbolTable symTab, SPLSymbolTable cSymTab] returns [Expression exp = null] 
+{
+   Expression arrExp1 = null;
+   Expression arrExp2 = null;
+   ArrayList pList = null;
+   String ident = "";
+}
+        :
+        (arrExp1 = arrayIndex[symTab] ( id:IDENT {ident = id.getText();}( #(INDEX_OP arrExp2=expression[symTab]) | #(METHOD_CALL (pList = exprList[symTab])? )  )? )? )
+         
+{
+	try
+	{
+        exp = ExpressionFactory.createPostCollectExpression(arrExp1, ident,arrExp2 ,pList,cSymTab);
+        if(logger.isLoggable(Level.FINE))
+  			logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+exp.toString());
+   }
+	catch (SPLException excep)  
+	{
+            ASTWithLineNumber q = (ASTWithLineNumber)id; 
+			logger.severe(excep.getMessage()); 
+			logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+			//System.out.println(excep.getMessage());
+			//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+			System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+			throw new RecognitionException(excep.getMessage());			
+	}	 
+}
+          
+         ;           
+
+
+
+basicCollectExpr[SPLSymbolTable symTab]  returns [Expression expr=null]
+{
+  ArrayList paramList = new ArrayList();
+  Expression arrExp = null;
+  Expression postExpr = null;
+  SPLSymbolTable collectSymbolTable = new SPLSymbolTable();
+  collectSymbolTable.setSymbolTableType(SPLSymbolTable.BASICCOLLECT);
+  collectSymbolTable.setParentSymbolTable(symTab) ;
+  collectSymbolTable.setDefaultQualifier(symTab.getDefaultQualifier());
+  
+  //symTab.addChildSymbolTable(collectSymbolTable);
+  
+
+}  
+        :
+       #(c:BASICCOLLECTION_OP paramList = exprList[collectSymbolTable]  )
+{
+	try
+	{
+		//System.out.println("calling Expression factory to create Basic Collection Expression");
+        expr = ExpressionFactory.createBasicCollectExpression(paramList,collectSymbolTable);
+		if(expr!=null){
+			if(logger.isLoggable(Level.FINE))
+  				logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+expr.toString());
+   
+		}
+		else{
+			logger.severe(Thread.currentThread().getName()+" "+"Basic collection expression not created by expression factory");
+		 	throw new SPLException("Basic collection expression not created by expression factory");
+		}
+		
+	}
+	catch (SPLException excep)  
+	{
+		ASTWithLineNumber q = (ASTWithLineNumber)c;
+		logger.severe(excep.getMessage());
+		logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+		//System.out.println(excep.getMessage());
+		//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+		System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+		throw new RecognitionException(excep.getMessage());	
+	}	    
+}   
+;
+   //
+//collectmethodcall[SPLSymbolTable symTab, SPLSymbolTable cSymTab] returns [ArrayList pList = null]
+//{
+  //      pList = new ArrayList();
+   //     Expression e= null;
+//}
+//:
+ //e=expression[symTab] {pList.add(e);} e=expression[symTab] {pList.add(e);}  e=expression[symTab] {pList.add(e);} e=expression[symTab] {pList.add(e);} e=expression[symTab] { cSymTab.setAnchorObject(s.getText());} ( e=expression[cSymTab] {pList.add(e);})? e=expression[cSymTab] {pList.add(e);} 
+ 
+//;
+
+         
+        
+
+exprList[SPLSymbolTable symTab] returns [ArrayList eList = new ArrayList()]
+{
+   Expression e = null;
+}
+	:	#( ELIST (e = expression[symTab] {eList.add(e);/*//System.out.println("exprlist: created expression, added it to eList"+e);*/} )* )
+	;
+       
+ arrayIndex[SPLSymbolTable symTab] returns [Expression e = null]
+	:	#(INDEX_OP e=expression[symTab] )
+	; 
+
+
+constant returns [Expression ce = null]:  
+			  
+       		ni:NUM_INT  
+			{ 
+				try 
+				{
+					ce = ExpressionFactory.createExpression(ni.getText(),TypeConstants.intType);
+					if(logger.isLoggable(Level.FINE))
+  						logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+ce.toString());
+   
+				}
+				catch (SPLException excep) 
+				{
+					ASTWithLineNumber q = (ASTWithLineNumber)ni;
+					logger.severe(excep.getMessage());
+					logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+					//System.out.println(excep.getMessage());
+					//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+					System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+					throw new RecognitionException(excep.getMessage());	
+				}
+			}
+        |   cl:CHAR_LITERAL  
+        	{ 
+        		try 
+        		{
+        			ce = ExpressionFactory.createExpression(cl.getText(),TypeConstants.charType);
+        			if(logger.isLoggable(Level.FINE))
+  						logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+ce.toString());
+   
+        		}
+        		catch (SPLException excep) 
+        		{
+        			ASTWithLineNumber q = (ASTWithLineNumber)cl;
+					logger.severe(excep.getMessage());
+					logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+					//System.out.println(excep.getMessage());
+					//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+        			System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+					throw new RecognitionException(excep.getMessage());
+        		}
+        	}
+        |   sl:STRING_LITERAL 
+        	{ 
+        		try 
+        		{
+        			ce = ExpressionFactory.createExpression(sl.getText(),TypeConstants.stringType);
+        			if(logger.isLoggable(Level.FINE))
+  						logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+ce.toString());
+   
+        		}catch (SPLException excep) 
+        		{
+        			ASTWithLineNumber q = (ASTWithLineNumber)sl;
+					logger.severe(excep.getMessage());
+					logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+					//System.out.println(excep.getMessage());
+					//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+        			System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+					throw new RecognitionException(excep.getMessage());
+        		}
+        	}
+        |   nf:NUM_FLOAT 
+        	{ 
+        		try 
+        		{
+        			ce = ExpressionFactory.createExpression(nf.getText(),TypeConstants.floatType);
+        			if(logger.isLoggable(Level.FINE))
+  						logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+ce.toString());
+   
+        		}
+        		catch (SPLException excep) 
+        		{
+        			ASTWithLineNumber q = (ASTWithLineNumber)nf;
+					logger.severe(excep.getMessage());
+					logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+					//System.out.println(excep.getMessage());
+					//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+        			System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+					throw new RecognitionException(excep.getMessage());
+        		}
+        	}
+        |   nl:NUM_LONG  
+        	{ 
+        		try 
+        		{
+        			ce = ExpressionFactory.createExpression(nl.getText(),TypeConstants.longType);
+        			if(logger.isLoggable(Level.FINE))
+  						logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+ce.toString());
+   
+        		}
+        		catch (SPLException excep) 
+        		{
+        			ASTWithLineNumber q = (ASTWithLineNumber)nl;
+					logger.severe(excep.getMessage());
+					logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+					//System.out.println(excep.getMessage());
+					//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+        			System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+					throw new RecognitionException(excep.getMessage());
+        		}
+        	}
+        |   nd:NUM_DOUBLE 
+        	{ 
+        		try 
+        		{
+        			ce = ExpressionFactory.createExpression(nd.getText(),TypeConstants.doubleType);
+        			if(logger.isLoggable(Level.FINE))
+  						logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: expression created "+ce.toString());
+   
+        		} 
+        		catch (SPLException excep) 
+        		{
+        			ASTWithLineNumber q = (ASTWithLineNumber)nd;
+					logger.severe(excep.getMessage());
+					logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+					//System.out.println(excep.getMessage());
+					//System.out.println("TreeParser::Exception inserting symbol at line "+q.getLine());
+        			System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+excep.getMessage());
+					throw new RecognitionException(excep.getMessage());
+        		}
+        	}
+;
+
+
+
+actionBlock[SPLSymbolTable symTab] returns [ActionBlock ab = null]
+{
+  ActionBlock ab1 = null;
+  ActionBlock ab2 = null;
+}
+:
+                 #(ARROW ab1 = actionBlock[symTab] ab2 = actionBlock[symTab]) 
+                {
+                 	ab = ActionFactory.createAction(ab1,ab2,ARROW,symTab); 
+                 	if(logger.isLoggable(Level.FINE))
+  						logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: ARROW ActionBlock created ");
+   
+                }
+                |#(LOR ab1 = actionBlock[symTab] ab2 = actionBlock[symTab]) 
+                {
+                	ab = ActionFactory.createAction(ab1,ab2,LOR,symTab); 
+                	if(logger.isLoggable(Level.FINE))
+  						logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: LOR ActionBlock created ");
+   
+                }
+                |#(LAND ab1 = actionBlock[symTab] ab2 = actionBlock[symTab])
+                {
+                	ab = ActionFactory.createAction(ab1,ab2,LAND,symTab); 
+                	if(logger.isLoggable(Level.FINE))
+  						logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: LAND ActionBlock created ");
+   
+                }
+                |#(BOR ab1 = actionBlock[symTab] ab2 = actionBlock[symTab]) 
+                {
+                	ab = ActionFactory.createAction(ab1,ab2,BOR,symTab); 
+                	if(logger.isLoggable(Level.FINE))
+  						logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: BOR ActionBlock created ");
+   
+                }
+                | ab = basicActionBlock[symTab]
+       ;
+                             
+                        
+basicActionBlock[SPLSymbolTable symTab] returns [ActionBlock ab=null] :
+{
+        ArrayList paramList = new ArrayList();
+        String ident1 = null;
+        String ident2 = "";
+        String st = "";
+        String op = ""; 
+        MethodSymbol x=null;
+        SPLSymbolTable table=symTab;
+        Expression c = null;
+       
+}
+   #( ACTIONBLOCK
+   				( 
+   					id1:IDENT {ident1 = id1.getText(); } 
+            	|     
+            		s:"Set" {st = s.getText();} 
+            	|
+            		i:"InvokePolicy" {st = i.getText();} 
+            	) 
+            	
+            	( 
+            		id2:IDENT 
+            			{
+            				ident2 = id2.getText();
+            				try
+            				{
+            					//System.out.println(" trying to get method  : "+ ident1+"."+ident2	);
+            					x = (MethodSymbol)symTab.getSymbol(ident1+"."+ident2);
+            				}
+            				catch (SPLException ex)
+            				{
+            					//System.out.println(" symTab get method Symbol failed : "+ ex.getMessage()	);
+            				}		
+            				if(x!=null)
+            				{
+            					//System.out.println(" x != null");
+            					SPLSymbolTable methodTable=x.getMethodSymbolTable(); 
+            					if(methodTable!=null)
+            					{
+            						//System.out.println("table is not null therefore table.setParentSymbolTable(symTab)");
+            						table=methodTable;
+            						table.setParentSymbolTable(symTab); 
+            					}
+            					else
+            					{
+            						//System.out.println("table is null therefore table=symTab");
+            						table=symTab;
+            					}
+            				}
+            				else
+            				{
+            					//System.out.println("x is null therefore table=symTab");
+            					table=symTab;
+            				}
+            			} 
+            	)?  
+            	
+    			#(METHOD_CALL 
+    						(
+    							paramList = exprList[table]
+    						)
+      			 ) 
+      			 
+            	(
+            		(
+            			e:EQUAL {op = e.getText();}
+            		| 
+            			ne:NOT_EQUAL {op = ne.getText();} 
+            		|
+            			ge:GE {op = ge.getText();}
+            		| 
+            			gt:GT {op = gt.getText();}
+            		| 
+            			lt:LT {op = lt.getText();}
+            		| 
+            			le:LE {op = le.getText();} 
+            		) 
+            	
+            		c=constant
+           		)?
+     )  
+{
+       //System.out.println("ident1, ident2 "+ident1+" "+ ident2);
+       try
+       {
+       	//System.out.println("creating action : "+ident1+" "+ident2+" "+st+" "+op);
+        ab = ActionFactory.createAction(ident1, ident2, paramList, st, op, c,symTab);
+        if(logger.isLoggable(Level.FINE))
+  			logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: basicActionBlock created ");
+       }
+       catch (SPLException ex)
+       {
+       	   ASTWithLineNumber q = (ASTWithLineNumber)id1;
+			logger.severe(ex.getMessage());
+			logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine());
+		//System.out.println(ex.getMessage());
+		//System.out.println("TreeParser::Exception inserting action at line "+q.getLine());
+        	System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+ex.getMessage());
+			throw new RecognitionException(ex.getMessage());
+       	
+       }		 	
+   
+        
+}                 
+             
+;    
+
+policyGroup[SPLSymbolTable symTab] returns [PolicyGroup pg = null]:
+{
+   String assocName = "CIM_Component";
+   String role1="GroupComponent";
+   String role2="PartComponent";
+   SPLPolicy c = null;
+ 
+}
+#(POLICY_GRP_DEF (#(ASSOCIATION #(id1:IDENT id2:IDENT id3:IDENT {assocName = id1.getText(); role1=id2.getText(); role2=id3.getText();} ))) c=splpolicy[dataCollector,symTab] p:priority)
+{
+   
+   pg = new PolicyGroup(assocName,role1,role2,c,p.getText(),symTab);
+   if(logger.isLoggable(Level.FINE))
+  		logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: PolicyGroup created ");
+         
+}        
+;    
+              
+
+splType returns [String tp]
+{
+    boolean isArray = false;
+    tp="";
+    
+    
+}
+:
+	 t:basicSplTypes (LBRACK RBRACK {isArray = true;})?
+{
+    tp = t.getText();
+    //System.out.println(" cimtype = "+tp);
+    if (isArray)
+    {
+        tp=tp+"[]";
+        //System.out.println(" adding [] to cimtype = "+tp);
+    }
+    //System.out.println(" cimtype = "+tp);
+   
+}         
+        ;
+        
+basicSplTypes :
+"Sint8" | "Sint16" | "Uint8" | "Uint16" | 
+ "Sint32" | "Sint64" | "Uint32" | "Uint64" |
+    "Real32" | "Real64" | "Boolean" | "Char16"|
+     "String" | "DateTime" | "Reference" 
+;    
+
+
+



Mime
View raw message