public Parser(){
		
	    String input = Utilities.ReadStringFromInput();
	    List<String> list = Arrays.asList(input.split("\n"));
	    Iterator<String> it = list.iterator();
	    String line = it.next();
	    	
	    if(line.substring(0,2).equals("%V")){
			FillNonTerminalSymbols(line);
			line = it.next();
		};
		// Now add a helper initial non terminal symbol at the beginning of the array.
		// <S'>   ->   <S>
		Symbol tempHS = new Symbol();
		tempHS.mIsTerminal = false;
		tempHS.mSy = "<S'>";
		mSymbols.add(0, tempHS);
		
		if(line.substring(0,2).equals("%T")){
			FillTerminalSymbols(line);
			line = it.next();
		}
	
		if(line.substring(0,4).equals("%Syn")){
			FillSyncronizationSymbols(line);
			if(it.hasNext()){
				line = it.next();
			}
			else{
				line=null;
			}
		}
		
		Production temp = null;
		int productionPriority = 1;
		int currentLeftSideSymIndex = 0;
		while(line != null){
			if (line.substring(0,1).equals("<")){ // should we change production's left side
				currentLeftSideSymIndex = FindSymbolIndex(line);
			}else{ // or work on the current one
				temp = new Production();
				temp.mProductionPriority = productionPriority++;
				temp.mLeftNonTerminalSymbolIndex = currentLeftSideSymIndex;
				FillProduction(temp, line);
				mProductions.add(temp);
			}
			
			if(it.hasNext()){
				line = it.next();
			}
			else{
				line=null;
			}
		};
		// Now add a production for the initial non terminal helper symbol.
		// <S'>   ->   <S>
		temp = new Production();
		temp.mLeftNonTerminalSymbolIndex = 0;
		temp.mRightSymbolsIndices = new ArrayList<Integer>();
		temp.mRightSymbolsIndices.add(1);
		temp.mProductionPriority = 0;
		mProductions.add(temp);	
	}