Support for full compaction command.
diff --git a/asterix-aql/src/main/javacc/AQL.jj b/asterix-aql/src/main/javacc/AQL.jj
index cb6336b..8ef6db6 100644
--- a/asterix-aql/src/main/javacc/AQL.jj
+++ b/asterix-aql/src/main/javacc/AQL.jj
@@ -193,6 +193,7 @@
     | stmt = DeleteStatement()
     | stmt = UpdateStatement()       
     | stmt = FeedStatement()
+    | stmt = CompactStatement()
     | stmt = Query()
   )
   {
@@ -296,11 +297,13 @@
   String typeName = null;
   String adapterName = null;
   Map<String,String> properties = null;
+  Map<String,String> compactionProperties = null;
   FunctionSignature appliedFunction = null;
   List<String> primaryKeyFields = null;
   String nodeGroupName = null;
   Map<String,String> hints = new HashMap<String,String>();  
   DatasetDecl dsetDecl = null;
+  String compactionPolicy = null;
 }
 {
   (
@@ -309,6 +312,7 @@
     ifNotExists = IfNotExists()
     "using" adapterName = AdapterName() properties = Configuration()
     ( "hints" hints = Properties() )?
+    ( "using" "compaction" "policy" compactionPolicy = CompactionPolicy() compactionProperties = Configuration() )?
       {
         ExternalDetailsDecl edd = new ExternalDetailsDecl();
         edd.setAdapter(adapterName);
@@ -329,6 +333,7 @@
     (appliedFunction = ApplyFunction())? primaryKeyFields = PrimaryKey()
     ( "on" nodeGroupName = Identifier() )?
     ( "hints" hints = Properties() )?
+    ( "using" "compaction" "policy" compactionPolicy = CompactionPolicy() compactionProperties = Configuration() )?
       {
         FeedDetailsDecl fdd = new FeedDetailsDecl(adapterName,
                                                   properties,
@@ -350,6 +355,7 @@
     ifNotExists = IfNotExists()
     primaryKeyFields = PrimaryKey() ("on" nodeGroupName = Identifier() )?
     ( "hints" hints = Properties() )?
+    ( "using" "compaction" "policy" compactionPolicy = CompactionPolicy() compactionProperties = Configuration() )?
       {
         InternalDetailsDecl idd = new InternalDetailsDecl(nodeGroupName != null
                                                             ? new Identifier(nodeGroupName)
@@ -376,7 +382,9 @@
   String fieldExpr = null;
   boolean ifNotExists = false;
   Pair<Identifier,Identifier> nameComponents = null;
+  Map<String,String> compactionProperties = null;
   IndexParams indexType = null;
+  String compactionPolicy = null;
 }
 {
   "index" indexName = Identifier()
@@ -391,6 +399,7 @@
       cis.addFieldExpr(fieldExpr);
     }
   )* <RIGHTPAREN> ( "type" indexType = IndexType() )?
+  ( "using" "compaction" "policy" compactionPolicy = CompactionPolicy() compactionProperties = Configuration() )?
     {
       cis.setIndexName(new Identifier(indexName));
       cis.setIfNotExists(ifNotExists);
@@ -404,6 +413,17 @@
     }
 }
 
+String CompactionPolicy() throws ParseException :
+{
+  String compactionPolicy = null;
+}
+{
+  compactionPolicy = Identifier()
+    {
+	  return compactionPolicy;
+    }
+}
+
 IndexParams IndexType() throws ParseException:
 {
   IndexType type = null;
@@ -772,6 +792,21 @@
     }
 }
 
+Statement CompactStatement() throws ParseException:
+{
+  Pair<Identifier,Identifier> nameComponents = null;
+  Statement stmt = null;
+}
+{
+  "compact" <DATASET> nameComponents = QualifiedName()
+    {
+	  stmt = new CompactStatement(nameComponents.first, nameComponents.second);
+    }
+    {
+	  return stmt;  
+    }
+}
+
 Statement FeedStatement() throws ParseException:
 {
   Pair<Identifier,Identifier> nameComponents = null;