diff -ru grail/3.0/Makefile 3.0/Makefile
--- grail/3.0/Makefile	Tue Sep 15 17:55:55 1998
+++ 3.0/Makefile	Wed Oct  8 01:16:02 2003
@@ -8,10 +8,12 @@
 #		SUN	- if you're using USL's Cfront under Sun OS
 #		WAT	- if you're using Watcom under DOS
 #		SGI	- if you're using Delta/C++ compiler under IRIX
+#		GCC	- if you are using some modern Unix with gcc compiler
 #SYS=WAT
 #SYS=XLC
 #SYS=DEC
-SYS=SUN
+#SYS=SUN
+SYS=GCC
 #SYS=SGI
 
 MAKE =make
@@ -21,6 +23,7 @@
 SUNCC=CC
 XLCCC=xlC
 WATCC=wcl386
+GCCCC=c++
 #	we've tested DCC, but it wasn't available to us to
 #	produce our SGI binaries; we used cfront on SGI
 #SGICC=DCC
@@ -47,6 +50,7 @@
 #
 #SGIFL = -non_shared -O2 -Olimit 15000 -o grail.out
 SGIFL = -O2 -Olimit 15000 -o grail.out
+GCCFL = -O2 -g -DATT -DUSE_TPLT -o grail.out
 
 all:
 #
@@ -103,6 +107,13 @@
 #	@$(MAKE) install_SGI TYPE=mlyint
 	@echo "Everything made"
 
+gcc:
+	@$(MAKE) install_GCC TYPE=char
+#       @$(MAKE) install_GCC TYPE=re
+#       @$(MAKE) install_GCC TYPE=mlychar
+#       @$(MAKE) install_GCC TYPE=mlyint
+	@echo "Everything made"
+
 compile_DEC:
 	@cd $(TYPE); $(MAKE) CC='$(DECCC)' CCFLAGS='$(DECFL)' BIN=../binaries/dec/
 
@@ -115,6 +126,9 @@
 compile_SGI:
 	@cd $(TYPE); $(MAKE) CC='$(SGICC)' CCFLAGS='$(SGIFL)' BIN=../binaries/sgi/
 
+compile_GCC:
+	 @cd $(TYPE); $(MAKE) CC='$(GCCCC)' CCFLAGS='$(GCCFL)' BIN=../binaries/gnu/
+
 compile_WAT:
 	@cd $(TYPE)
 	@$(MAKE) make_dos CC=$(WATCC) "CCFLAGS=$(WATFL)" BIN=..\binaries\486\ 
@@ -137,6 +151,9 @@
 install_SGI:
 	@cd $(TYPE); $(MAKE) install CP="ln -s" BIN=../binaries/sgi/ I_BIN=../bin/
 
+install_GCC:
+	@cd $(TYPE); $(MAKE) install CP="ln -s" BIN=../binaries/gnu/ I_BIN=../bin/
+
 checkout:
 	@$(MAKE) checkout_$(SYS)
 
@@ -166,7 +183,7 @@
 	@rm -rf bin\* mon.out core tests\errors\*
 	@echo Everything clean.
 
-clean_XLC clean_SGI clean_DEC clean_SUN:
+clean_XLC clean_SGI clean_DEC clean_SUNi clean_GCC:
 	@cd char; $(MAKE) clean
 	@cd re; $(MAKE) clean
 	@cd mlychar; $(MAKE) clean
Only in 3.0/binaries: gnu
diff -ru grail/3.0/char/grail.C 3.0/char/grail.C
--- grail/3.0/char/grail.C	Thu Oct 22 00:23:25 1998
+++ 3.0/char/grail.C	Wed Oct  8 00:22:49 2003
@@ -29,7 +29,8 @@
 
 	// get my name
 
-	for (int i=strlen(argv[0]); i>0; --i)
+	int i;
+	for (i=strlen(argv[0]); i>0; --i)
 		if ((argv[0][i] == '/') || (argv[0][i] == '\\'))
 		{
 			++i;
diff -ru grail/3.0/classes/afa/afa.h 3.0/classes/afa/afa.h
--- grail/3.0/classes/afa/afa.h	Mon Oct 26 05:24:40 1998
+++ 3.0/classes/afa/afa.h	Wed Oct  8 01:08:24 2003
@@ -52,12 +52,17 @@
 
 #include <iostream.h>
 
+#ifdef USE_TPLT
+#define TPLT <>
+#endif
+
+
 template <class T>
 class afa {
 
-           friend istream& operator>>(istream&, afa<T>&);
+           friend istream& operator>>TPLT(istream&, afa<T>&);
 
-           friend ostream& operator<<(ostream&, const afa<T>&);
+           friend ostream& operator<<TPLT(ostream&, const afa<T>&);
 
     private:
 
diff -ru grail/3.0/classes/afa/dnf/function.src 3.0/classes/afa/dnf/function.src
--- grail/3.0/classes/afa/dnf/function.src	Mon Oct 26 05:24:42 1998
+++ 3.0/classes/afa/dnf/function.src	Wed Oct  8 00:45:36 2003
@@ -591,17 +591,18 @@
 {
   funct negation;
   term* tmp = head;
-  term false(0,1), true(0,0);
-  negation.append(true);
+  term _false(0,1);
+  term _true(0,0);
+  negation.append(_true);
   while (tmp != 0)
     {
-      if (*tmp == false)         //if the current term is constant 0
+      if (*tmp == _false)         //if the current term is constant 0
 	{
 	  term t(0,0);           //negation of 0 is 1
 	  negation = negation.and(t);
 	  return negation;       //the function has only one term
 	}
-      else if (*tmp == true)     //if the current term is constant 1
+      else if (*tmp == _true)     //if the current term is constant 1
 	{
 	  term t(0,1);           //negation of 1 is 0
 	  negation = negation.and(t);
diff -ru grail/3.0/classes/afa/expand.src 3.0/classes/afa/expand.src
--- grail/3.0/classes/afa/expand.src	Mon Oct 26 05:24:41 1998
+++ 3.0/classes/afa/expand.src	Wed Oct  8 00:04:59 2003
@@ -89,7 +89,7 @@
   //= x_(states+1), otherwise it is 1
   term temp((unsigned)pow(2,states),(unsigned) pow(2,states));
   funct x_n(temp);
-  for (k=0; k<ssize; k++)
+  for (int k=0; k<ssize; k++)
 	{
 		int index = symbol.member(a[k]);
 		if (index>=0)
diff -ru grail/3.0/classes/afa/fmtoafa.src 3.0/classes/afa/fmtoafa.src
--- grail/3.0/classes/afa/fmtoafa.src	Mon Oct 26 06:37:58 1998
+++ 3.0/classes/afa/fmtoafa.src	Wed Oct  8 00:15:18 2003
@@ -182,7 +182,7 @@
 pivot = fn;
 pivotpos=ORD_INVERSE[pivot];
 
-for(i=fn;i<=fn+dif;i++)
+for(int i=fn;i<=fn+dif;i++)
   {
   if(pivotpos>ORD_INVERSE[i])
     {
@@ -205,7 +205,7 @@
 
 //build the head function
   int count = headlist.get_count();      //the number of node on mylist headlist
-  for (i=1; i<=count; i++)
+  for (int i=1; i<=count; i++)
     {
       int pos = *(headlist.get_ith_elem(i));
       unsigned alpha=0;
@@ -222,7 +222,7 @@
 //compute fcount and ncount----------------------------------------------------------------------
 
 unsigned fcount = 0, ncount = 0;
-for(i=0; i<=MAX; i++)
+for(int i=0; i<=MAX; i++)
   {
     if(head.evaluate(ORD[i]))
       fcount++;
@@ -236,7 +236,7 @@
 int npos=0, fpos=0;
 int * arrayf = new int[fcount], * arrayn =new int[ncount];
 
-for(i=0; i<=MAX; i++)
+for(int i=0; i<=MAX; i++)
   {
     if(head.evaluate(ORD[i]))
 	{
@@ -260,17 +260,17 @@
   sset-=fset;                      //the set of all nonfinal states of the dfa
 
 //init INCOUNTS
-for (i=0; i<total; i++) 
+for (int i=0; i<total; i++) 
 	INCOUNTS[i]=0;
 //build INCOUNTS
-for (i=0; i<delta.size(); i++)     //for each dfa instruction, find the sink, and increment its INCOUNT entry
+for (int i=0; i<delta.size(); i++)     //for each dfa instruction, find the sink, and increment its INCOUNT entry
 	INCOUNTS[delta[i].get_sink().value()]++;
  
 
   int indicator = 0;               //to indicate which array the start state in
   state_node* fstate=new state_node[fn], *nstate = new state_node [total - fn];
 
- for (i = 0; i<fn; i++)
+ for (int i = 0; i<fn; i++)
     {
       state tmp =fset[i];
       if (start_st.member(tmp)>=0)
@@ -279,7 +279,7 @@
         }
       fstate[i] = build_state_node(tmp, INCOUNTS[tmp.value()]);
     }
-  for (i =0; i<total -fn; i++)
+  for (int i =0; i<total -fn; i++)
     {
       nstate[i] = build_state_node(sset[i], INCOUNTS[sset[i].value()]);
     }
@@ -321,7 +321,7 @@
 //convert the final state list to a bit_vector
   {
     int count = F.get_count();
-    for (i=1; i<=count; i++)
+    for (int i=1; i<=count; i++)
       {
         int number = *(F.get_ith_elem(i));
         final += (unsigned)pow(2,number-1);
@@ -388,7 +388,7 @@
 }
 
 
-for (i = 0; i<symbolcount; i++)                           //now go through the table and simplify.
+for (int i = 0; i<symbolcount; i++)                           //now go through the table and simplify.
 {
     for (int j =1; j<=states; j++)
       {
@@ -406,7 +406,7 @@
 /*
 //See if the minimized functions are logically equiv to the simplified ones by comparing all truth assignments
 
-//for (i = 0; i<symbolcount; i++)                          
+//for (int i = 0; i<symbolcount; i++)                          
 //{
 //    for (int j =1; j<=states; j++)
 //      {
diff -ru grail/3.0/classes/afa/manage_bitvec.src 3.0/classes/afa/manage_bitvec.src
--- grail/3.0/classes/afa/manage_bitvec.src	Mon Oct 26 05:24:41 1998
+++ 3.0/classes/afa/manage_bitvec.src	Wed Oct  8 00:11:46 2003
@@ -65,7 +65,7 @@
 	curadds++;
       }
     //shifts
-    for(i=0; i<curadds; i++)
+    for(int i=0; i<curadds; i++)
       {
 	n = 2*ORD[curblock_strt + i];
 	while(n <= MAX)
diff -ru grail/3.0/classes/afa/reverse.src 3.0/classes/afa/reverse.src
--- grail/3.0/classes/afa/reverse.src	Mon Oct 26 06:13:03 1998
+++ 3.0/classes/afa/reverse.src	Wed Oct  8 00:09:39 2003
@@ -85,7 +85,7 @@
 	   int temp = q.pop();
 	   T1[index] = new int[column+1];
 	   T1[index][0] = temp;
-	   for (x=0; x<column; x++)
+	   for (int x=0; x<column; x++)
 		{
 		   int vector = transition(temp, x);
 		   T1[index][x+1] = vector;
@@ -98,11 +98,11 @@
 	   index++;
 	}
    
-   for (x = 0; x<big; x++)
+   for (int x = 0; x<big; x++)
 	I[x] = 0;
 
    int count = 0;
-   for (x=0; x<index; x++)
+   for (int x=0; x<index; x++)
       if(head.evaluate(T1[x][0]) == 1)
 	{
 	   q.push(T1[x][0]);
@@ -113,7 +113,7 @@
    while (!q.empty())
 	{
 	   int temp = q.pop();
-	   for (x=0; x<index; x++)
+	   for (int x=0; x<index; x++)
 	      if (I[T1[x][0]] == 0)
 		 for (int y=0; y<column; y++)
 		    if (T1[x][y+1] == temp)
@@ -141,7 +141,7 @@
 
    int *P=new int[count];
    int indic = 0;
-   for(x = 0; x<index; x++)
+   for(int x = 0; x<index; x++)
       if (I[T1[x][0]] == 1)
 	 {
 	    P[indic] =x;
@@ -183,12 +183,12 @@
 		}
 	}
 
-    for (k= 0; k<y_index; k++)
+    for (int k= 0; k<y_index; k++)
 	for (int l=0; l<column; l++)
 	   rafa.table[k*column+l].simplify();
     delete [] I;
     delete [] P;
-    for (i = 0; i<index; i++)
+    for (int i = 0; i<index; i++)
 	delete [] T1[i];
     delete [] T1;
     return rafa;
diff -ru grail/3.0/classes/afa/same_input_nonzero_state_cat.src 3.0/classes/afa/same_input_nonzero_state_cat.src
--- grail/3.0/classes/afa/same_input_nonzero_state_cat.src	Mon Oct 26 05:24:41 1998
+++ 3.0/classes/afa/same_input_nonzero_state_cat.src	Wed Oct  8 00:02:47 2003
@@ -87,7 +87,7 @@
 
 	int *P= new int[count];
 	int indic = 0;
-	for (x = 0; x<Isize; x++)
+	for (int x = 0; x<Isize; x++)
 	   {
 		if (I[x] == 1)
 		   {
@@ -143,7 +143,7 @@
 
 	//construct the rest transitions
 
-	for (i = states; i< states +count; i++)
+	for (int i = states; i< states +count; i++)
 	   for (int l=0; l<column; l++)
 		{
 		   cafa.table[i*column + l].append(term(0, 1));
@@ -160,7 +160,7 @@
 	for (int index = 0; index<states; index++)
 	   variable[index] = index+1;
 
-        for (index = 0; index<column; index++)
+        for (int index = 0; index<column; index++)
 	    {
 		funct *newt = new funct[states];
 		for (int k = 0; k<states; k++)
@@ -169,7 +169,7 @@
 		cafa.table[(states+I[a.final])*column+index].append(tmp);
 	    }
 
-	for (i = states; i<states + count; i++)
+	for (int i = states; i<states + count; i++)
 	   for (int m=0; m<column; m++)
                cafa.table[i*column+m].simplify();
 
diff -ru grail/3.0/classes/afa/star.src 3.0/classes/afa/star.src
--- grail/3.0/classes/afa/star.src	Mon Oct 26 05:24:41 1998
+++ 3.0/classes/afa/star.src	Tue Oct  7 23:53:34 2003
@@ -122,7 +122,7 @@
 
     int *P = new  int[count];
     int indic=0;
-    for (x=0; x<Isize; x++)
+    for (int x=0; x<Isize; x++)
 	{
 	   if (I[x] == 1)
 		{
@@ -145,7 +145,7 @@
 		alpha +=(unsigned) pow(2, i);
 	term t(alpha, beta);
 	safa.head.append(t);
-	for (i = 0; i<safa.states; i++)
+	for (int i = 0; i<safa.states; i++)
 	   {
 		if (head.evaluate(P[i]) == 1)
 		   {
@@ -205,7 +205,7 @@
   delete [] I;                //recycle space
   delete [] P;
 
-  for (i = 0; i<row; i++)
+  for (int i = 0; i<row; i++)
      for ( int l = 0; l<column; l++)
 	{
 	   safa.table[i*column+l].simplify();   //get rid of redundant terms
diff -ru grail/3.0/classes/array/fostream.src 3.0/classes/array/fostream.src
--- grail/3.0/classes/array/fostream.src	Tue Sep 15 17:55:15 1998
+++ 3.0/classes/array/fostream.src	Wed Oct  8 00:25:06 2003
@@ -55,7 +55,8 @@
 	os << "[";
 	if (s.size()>1)
 	  {
-	  	for (int i=0; i<s.size()-1; ++i)
+		int i; 
+	  	for (i=0; i<s.size()-1; ++i)
 	             os << s[i] << ",";
 		os<<s[i];
 		os << "]";
diff -ru grail/3.0/classes/array/lt.src 3.0/classes/array/lt.src
--- grail/3.0/classes/array/lt.src	Tue Sep 15 17:55:13 1998
+++ 3.0/classes/array/lt.src	Wed Oct  8 00:25:29 2003
@@ -68,7 +68,8 @@
 		return 0;
 
         // find two elements which differ
-	for (int i=0; i<sz; ++i)
+	int i;
+	for (i=0; i<sz; ++i)
 		if (p[i] != s.p[i])
 			break;
 	
diff -ru grail/3.0/classes/fl/fl.h 3.0/classes/fl/fl.h
--- grail/3.0/classes/fl/fl.h	Tue Sep 15 17:55:20 1998
+++ 3.0/classes/fl/fl.h	Wed Oct  8 01:06:26 2003
@@ -68,13 +68,17 @@
 
 
 #ifndef			FL_CLASS_DEFINITION
+#ifdef USE_TPLT
+#define TPLT <>
+#endif
+
 
 template <class Item>
 class fl
 {
 
-	friend	ostream& operator<<(ostream&, const fl<Item>&);
-	friend	istream& operator>>(istream&, fl<Item>&);
+	friend	ostream& operator<<TPLT(ostream&, const fl<Item>&);
+	friend	istream& operator>>TPLT(istream&, fl<Item>&);
 
 private:
 	set<string<Item> >	words;	// store enumeration of language
diff -ru grail/3.0/classes/fl/lquot.src 3.0/classes/fl/lquot.src
--- grail/3.0/classes/fl/lquot.src	Tue Sep 15 17:55:20 1998
+++ 3.0/classes/fl/lquot.src	Wed Oct  8 00:18:41 2003
@@ -68,7 +68,8 @@
 		if (words[i].size() >= s.size())
 		{
 			// check to see if we have a match
-			for (int j=0; j<s.size(); ++j)
+			int j;
+			for (j=0; j<s.size(); ++j)
 				if (words[i][j] != s[j])
 					break;
 
diff -ru grail/3.0/classes/fm/fltofm.src 3.0/classes/fm/fltofm.src
--- grail/3.0/classes/fm/fltofm.src	Tue Sep 15 17:55:08 1998
+++ 3.0/classes/fm/fltofm.src	Wed Oct  8 00:08:15 2003
@@ -75,7 +75,8 @@
 		curr = start;
 		for (int j=0; j<words[i].size(); ++j)
 		{
-			for (int k=0; k<t.size(); ++k)
+			int k;
+			for (k=0; k<t.size(); ++k)
 				if ((t[k].get_source() == curr) &&
 				    (t[k].get_label() == words[i][j]))
 					break;
diff -ru grail/3.0/classes/fm/fm.h 3.0/classes/fm/fm.h
--- grail/3.0/classes/fm/fm.h	Tue Sep 15 17:55:08 1998
+++ 3.0/classes/fm/fm.h	Wed Oct  8 01:05:48 2003
@@ -70,6 +70,10 @@
 
 
 #ifndef		FM_CLASS_DEFINITION
+#ifdef USE_TPLT
+#define TPLT <>
+#endif
+
 
 // specification for state role in an instruction
 enum { SOURCE, SINK, EITHER };
@@ -112,7 +116,7 @@
 	set<state>		final_states;	// set of final states
 
 // friend functions
-	friend istream&	operator>>(istream&, fm<Label>&);
+	friend istream&	operator>>TPLT(istream&, fm<Label>&);
 			// read an fm from the parameter stream.  Returns
 			//  a reference to the input stream.
 
diff -ru grail/3.0/classes/inst/inst.h 3.0/classes/inst/inst.h
--- grail/3.0/classes/inst/inst.h	Tue Sep 15 17:55:12 1998
+++ 3.0/classes/inst/inst.h	Wed Oct  8 01:03:08 2003
@@ -80,6 +80,9 @@
 
 
 #ifndef		INST_CLASS_DEFINITION
+#ifdef USE_TPLT
+#define TPLT <>
+#endif
 
 #include	<strstream.h>
 
@@ -90,7 +93,7 @@
 
         // friend functions
         friend  istream&
-        operator>>(istream&,inst<Label>&);              // stream input
+        operator>>TPLT(istream&,inst<Label>&);              // stream input
 
 private:
 
diff -ru grail/3.0/classes/pool/get.src 3.0/classes/pool/get.src
--- grail/3.0/classes/pool/get.src	Tue Sep 15 17:55:18 1998
+++ 3.0/classes/pool/get.src	Wed Oct  8 00:17:53 2003
@@ -76,7 +76,8 @@
 	        // compute the address of the associated block
         	int total = POOL_SIZE;
         	int old = 0;
-        	for (int j=0;  ; ++j)
+		int j;
+        	for (j=0;  ; ++j)
         	{
                 	if (total > i)
                         	break;
diff -ru grail/3.0/classes/re/re.h 3.0/classes/re/re.h
--- grail/3.0/classes/re/re.h	Tue Sep 15 17:55:02 1998
+++ 3.0/classes/re/re.h	Wed Oct  8 01:07:45 2003
@@ -165,6 +165,9 @@
  ***************************************************************************/
 
 #ifndef		RE_CLASS_DEFINITION
+#ifdef USE_TPLT
+#define TPLT <>
+#endif
 
 enum token_type
 {
@@ -807,10 +810,10 @@
 	static	char	re_right_symbol_delimiter;
 
 	friend
-	ostream&	operator<<(ostream&, const re<S>&);
+	ostream&	operator<<TPLT(ostream&, const re<S>&);
 
 	friend
-	istream&	operator>>(istream&, re<S>&);
+	istream&	operator>>TPLT(istream&, re<S>&);
 
 	friend		class cat_exp<S>;
 	friend		class plus_exp<S>;
diff -ru grail/3.0/classes/string/lt.src 3.0/classes/string/lt.src
--- grail/3.0/classes/string/lt.src	Tue Sep 15 17:55:06 1998
+++ 3.0/classes/string/lt.src	Wed Oct  8 00:20:59 2003
@@ -63,7 +63,8 @@
 		return 0;
 
 	// for equal size strings, find the first character which differs
-	for (int i=0; i<sz; ++i)
+	int i;
+	for (i=0; i<sz; ++i)
 		if (p[i] != s.p[i])
 			break;
 	
