anchor.diff:      		}
       	)? (delay 
       		{
  +    		  // TODO: ignored delay for untimed models
       			delayLB = $delay.delayLB; 
       			delayUB = $delay.delayUB;
       		}
       	)? ((assertion
       		{
  +    		  // TODO: ignored assertions temporarily
       			if($assertion.booleanExpr != null){		
     					assertionList.add($assertion.booleanExpr);
     				}
       		}
       	) | (assignment
       		{
  -    			assignmentList.add($assignment.assign);
  +    			assignmentList.putAll($assignment.assign);
       		}
       	))* '<' '/' 'transition' '>'
           {
           	// create new lpn transitions and add assertions
  -        	$lpnTran = new LPNTran($lbl.text, TransitionIndex++, presetList, postsetList, guardExpr, assignmentList, delayLB, delayUB, local);
  -        	if(assertionList.size() > 0){
  -        		$lpnTran.addAllAssertions(assertionList);
  +        	// $lpnTran = new LPNTran($lbl.text, TransitionIndex++, presetList, postsetList, guardExpr, assignmentList, delayLB, delayUB, local);
  +        	$lpnTran = new Transition();
  +        	$lpnTran.setName("t" + $lbl.text);
  +        	$lpnTran.setIndex(TransitionIndex++);
  +        	for (Place p: presetList) {
  +        	  $lpnTran.addPreset(p);
           	}
  -        	
  -        	// add non-local transition to associated LPNs
  -        	for(VarExpr e : assignmentList){
  -        		VarNode var = e.getVar();
  -        		if(Outputs.contains(var.getName())){
  -        			local = false;
  -        			
  -        			if(GlobalInputMap.containsKey(var.getName())){
  -	        			for(LPN lpn : GlobalInputMap.get(var.getName())){
  -	        				lpn.addInputTran($lpnTran);
  -	        				$lpnTran.addDstLpn(lpn);
  -	        			}
  -        			}
  -        		}
  -        		
  -        		// map lpn transition with output and potential outuput variables
  -        		if(GlobalTranMap.containsKey(var.getName())){
  -       				GlobalTranMap.get(var.getName()).add($lpnTran);
  -       			}
  -       			else{
  -       				List<LPNTran> tranList = new ArrayList<LPNTran>();
  -       				tranList.add($lpnTran);
  -       				GlobalTranMap.put(var.getName(), tranList);
  -       			}
  -        	}
  -        	
  -       		$lpnTran.setLocalFlag(local);
  +        	for (Place p: postsetList) {
  +            $lpnTran.addPostset(p);
  +          }
  +          $lpnTran.addEnablingWithoutLPN(guardExpr);
  +          for (String var : assignmentList.keySet()) {
  +            $lpnTran.addIntAssign(var, assignmentList.get(var));
  +          }
  +          
  +        	// TODO: Add assertionList to the new lpn transition
  +//        	if(assertionList.size() > 0){
  +//        		$lpnTran.addAllAssertions(assertionList);
  +//        	}
  +
  +          // add non-local transition to associated LPNs
  +          for(String var : assignmentList.keySet()){
  +            if(Outputs.contains(var)){
  +              // local is determined by isLocal() in Transition.java
  +              local = false;            
  +//              if(GlobalInputMap.containsKey(var)){
  +//                for(LhpnFile lpn : GlobalInputMap.get(var)){
  +//                  //lpn.addInputTran($lpnTran);
  +//                  // dstLpn is added by setDstLpnList in Transition.java
  +//                  // $lpnTran.addDstLpn(lpn);
  +//                }
  +//              }
  +            }
  +            
  +            // map lpn transition with output and potential outuput variables
  +            if(GlobalTranMap.containsKey(var)){
  +              GlobalTranMap.get(var).add($lpnTran);
  +              System.out.println("Add "+ $lpnTran.getName() + " to variable " + var);
  +            }
  +            else{
  +              List<Transition> tranList = new ArrayList<Transition>();
  +              tranList.add($lpnTran);
  +              GlobalTranMap.put(var, tranList);
  +              System.out.println("Create tranList for variable " + var + ", and add " + $lpnTran.getName() + " to it.");
  +              
  +            }
  +          }
  +
  +//       		$lpnTran.setLocal(local);
          		if(local == false){
          			outputTranList.add($lpnTran);
          		}
           }
       ;
     
  -assertion returns [Expression booleanExpr]
  -	:	{booleanExpr = null;}
  +assertion returns [ExprTree booleanExpr]//[Expression booleanExpr]
  +	:	{booleanExpr = null;// TODO: assertion
  +	} 
   		'assert' '(' expression ')' ';'
   			{
  -				$booleanExpr = new Expression($expression.expr);
  +				//$booleanExpr = new Expression($expression.expr);
  +				$booleanExpr = new ExprTree($expression.expr);
   			}
   	;
   	
  -guard returns [Expression expr]
  +guard returns [ExprTree expr]//[Expression expr]
       :   expression ';'
       		{
  -   				$expr = new Expression($expression.expr);
  +   				//$expr = new Expression($expression.expr);
  +   				$expr = new ExprTree($expression.expr);
       		}
       ;
       
  
positive.code: }
  
  @lexer::header{
      package platu.lpn.io;
  }
  
  parseLpnFile[Project prj, boolean instance, HashMap<String, String> portMap] returns [Set<LPN> lpnSet]
  	:	
  	;
  	
  lpn[Project prj] returns [Set<LPN> lpnSet]
      :   {$lpnSet = new HashSet<LPN>();}
          ((globalConstants globalVariables) | (globalVariables globalConstants) | (globalVariables) | (globalConstants))?
          	{
          		// check that global constants are consistently defined in each lpn file
  
negative.code: //	                zone = new HashedHashedMapZoneImpl();
  //	           	}
  	            
  //	            int i = 0;
  //	            int[] initialMarking = new int[$logic.initMarking.size()];
  //	            for(Integer mark : $logic.initMarking){
  //	            	initialMarking[i++] = mark;
  //	            }
  
  //				$lpn = new LPN(prj, $ID.text, Inputs, Outputs, Internals, VarNodeMap, $logic.lpnTranSet, 
  //	         			StatevectorMap, initialMarking);
          $lpn = new LhpnFile();
          $lpn.setLabel($ID.text);
          System.out.println("---- LPN : " + $lpn.getLabel() + "----");
          for (Transition t: $logic.lpnTranSet) {
            $lpn.addTransition(t);
            t.setLpn($lpn);
            System.out.println("transition(logic): " + t.getName());
            for (Place p : t.getPreset()) {
              if ($logic.initMarking.contains(p.getName())) 
                $lpn.addPlace(p.getName(), true);
              else
                $lpn.addPlace(p.getName(), false);
              $lpn.getPlace(p.getName()).addPostset(t);            
            }
            for (Place p : t.getPostset()) {
              if ($logic.initMarking.contains(p.getName())) 
                $lpn.addPlace(p.getName(), true);
              else
                $lpn.addPlace(p.getName(), false);
              $lpn.getPlace(p.getName()).addPreset(t);
            }   
          }
          
  //				for(Transition tran : inputTranList){
  //					tran.addDstLpn($lpn);
  //				}
  //				$lpn.addAllInputTrans(inputTranList);
  //				$lpn.addAllOutputTrans(outputTranList);
  //	      $lpn.setVarIndexMap(VarIndexMap);         
  //	      $logic.lpnTranSet.setLPN($lpn);     
  //	      prj.getDesignUnitSet().add($lpn.getStateGraph());
            
  //          for (Transition t : inputTranList) {
  //            System.out.println("transition(in): " + t.getName()); 
  //            $lpn.addTransition(t);
  //          }
            for (Transition t : outputTranList) {
              System.out.println("transition(out): " + t.getName());
              $lpn.addTransition(t);
            }
            
  	        LpnMap.put($lpn.getLabel(), $lpn);
  //	        for (String var : StatevectorMap.keySet()) {
  //	          $lpn.addInteger(var, StatevectorMap.get(var)+"");
  //	        }
  	        
  	        // TODO: Where to use these hashmaps?
            // map outputs to lpn object
            for(String output : Outputs){
              GlobalOutputMap.put(output, $lpn);
              $lpn.addOutput(output, "integer", StatevectorMap.get(output)+"");
              System.out.println("@1: Added output variable " + output + " to LPN " + $lpn.getLabel());
            }
            // map potential output to lpn object
            for(String internal : Internals){
              GlobalOutputMap.put(internal, $lpn);
              $lpn.addInternal(internal, "integer", StatevectorMap.get(internal)+"");
              System.out.println("@1: Added internal variable " + internal + " to LPN " + $lpn.getLabel() + "with initial value " + StatevectorMap.get(internal));
  	        }
            // map input variable to lpn object
            for(String input : Inputs) {
              if(GlobalInputMap.containsKey(input)){
                GlobalInputMap.get(input).add($lpn);
                $lpn.addInput(input, "integer", StatevectorMap.get(input)+"");
                System.out.println("@1: Added input variable " + input + " to LPN " + $lpn.getLabel() + " with initial value " + StatevectorMap.get(input) + ".");
  	          }
            	else{
            	  List<LhpnFile> lpnList = new ArrayList<LhpnFile>();//List<LPN> lpnList = new ArrayList<LPN>();
             	  lpnList.add($lpn);
             	  GlobalInputMap.put(input, lpnList);
             	  $lpn.addInput(input, "integer", StatevectorMap.get(input)+"");
             	  System.out.println("@2: Added input variable " + input + " to LPN " + $lpn.getLabel() + " with initial value " + StatevectorMap.get(input) + ".");
             	}
            }
            
  			}
  		)
      ;
  