public String analysePif(List<Scanner.pif> pifs, List<String> indentifiersST, List<String> constantsST){
		System.out.println("------------------------- ANALYSIS PIFS ------------------------------");
		String output="";
		

		List<Object> stack = new ArrayList<>();
		stack.add(states.get(0));
		
		
		while(true){
			
			int last_pos= stack.size()-1;
			Object obj =  stack.get(last_pos);
			
			if( obj instanceof State){
				
				State s = (State)obj;
				
				switch(s.action){
					case "shift":
						
						if( pifs.size() == 0)
							return "error: shift but no more input left";
						//String inp_shift = pif.substring(0, 1);
						//input = input.substring(1);
						//stack.add(inp_shift);
						
						Scanner.pif pif = pifs.remove(0);
						stack.add(pif);
						
						if ( !s.go_to.containsKey(String.valueOf(pif.code))){
							return "ERROR: goto from state: "+s.toString()+" \nto "+ pif.code + " is not possible";
						}
						
						int new_state_index = s.go_to.get(String.valueOf(pif.code));
						State new_state = states.get(new_state_index);
						stack.add(new_state);
						
						break;
						
					case "accept":
						return output;
						
					case "reduce":
												
						 //reduce state print
						
						int prod_index = s.reduce_pos;
						Production p = productions.get(prod_index-1);
						int rhp_size = p.getRight().size();
						//stack = stack.subList(0, stack.size()-rhp_size*2);
						//stack.subList(stack.size()-1 - rhp_size*2, stack.size()-1).clear();
						for( int i = 0; i < rhp_size*2; i++){
							stack.remove(stack.size()-1);
						}
						
						
						State last_state = (State)stack.get(stack.size()-1);
						stack.add(p.getLeft());
						
						if ( !last_state.go_to.containsKey(p.getLeft())){
							return "ERROR reduce: goto from state "+s.toString()+" \nto "+ p.getLeft() + " is not possible";
						}
						new_state_index = last_state.go_to.get(p.getLeft());
						new_state = states.get(new_state_index);
						stack.add(new_state);
						output= prod_index+", "+output;
						
						break;
				}
			}
		}
		
	}