import java.util.*;
import java.io.*;

class preas
{
    public static void main(String args[])
    {
	Vector inputInstructions = new Vector();
	
	BufferedReader file = null;
	
	String filename=args[0];
	
	System.err.println("PREAS processing: " + filename);

	try
	    {
		// open the file
		file = new BufferedReader(new FileReader(filename));
	    }
	catch(FileNotFoundException f)
	    {
		System.err.println("File not found: " + f);
		System.exit(-1);
	    }
	
	try
	    {
		String str = file.readLine();
		
		while(str != null)
		    {
			inputInstructions.addAll(FirstPass.processLine(str));
			
			str = file.readLine();
		    }
	    }
	catch(IOException e)
	    {
		System.err.println("File formatting problem: " + e);
		System.exit(-1);
	    }

	System.err.println("Pseudo Instruction Counters: \n" + FirstPass.getCounters());

	for(int i=0; i<inputInstructions.size(); i++)
	    {
		// send each line of the new file to stdout
		System.out.println((String)inputInstructions.elementAt(i));
	    }
    }
}