import java.awt.*;import java.applet.Applet;          class Globals { 	public static final char StoppingCharacter = '/'; 	// In the definition of section where the grammar is defined, this character is used to separate the different}	//productions that could occur. When it occurs twice, it signifies the end of the production...}    public static final char VariableSignifier = '*';		// If the first character of a word equals this then the program shall treat the word as a variable which }		// will undergo more transformations. Note the program ASSUMES that a variable is one word.}   public static final char EqualityCharacter = '=';		// There is a character which signifies the equality between a variable and set of productions.}   public static final char EndOfFileSignifier =  (char)(0);		// This is passed back from NextWord when it finds it is at the end of the file...}   public static final String NullWord = " ";		// This is what comes back from NextWord if it can't find something...}   public static final char Space = ' ';		//This is something different, but the same. It is the same thing, but used in a different fashion. }			public static final boolean AddCarriageReturns=true;		// If we want to do some word wrapping, this is inserted.	public static final int RightMargin=50;		// The margin for wrapping.	} class WordNode {	String w1;		// The string being stored here.	WordNode next;		// What comes next in the list. null is nothing.			public WordNode(){		w1="";		next=null;	}		public void setW1(String s){		w1=s;	}			public WordNode (String s){		w1=s;		next=null;	}		public WordNode (String s, WordNode n){		w1=s;		next=n;	}		public void setNext(WordNode n){		next =n;	}		public WordNode getNext(){		return next;	}}     class BitNode {	int bitNumber=-1;		// This is the number of a central register of bits.	boolean polarity=true;	double probability;		// The total probability of all subordinate nodes.	BitNode up;		// What comes up.	BitNode left,right;		// For building a tree.	ProductionNode theProductionNode;			/*Well, technically, I could get away with storing this pointer in either left or  			 right because left and right will equal nil if and only if TheProductionNode <> nil, but 			 I don't feel like packing this too tightly right now. I'm being lavish with memory.			 */		public BitNode(){		up=null;		left=null;		right=null;		bitNumber=0;		polarity=true;		probability=1.0;	}		public void setProbability(double d){		probability = d;	}}    class ProductionNode { 	double probability; 		// The Probability that this particular production will be chosen. 	BitNode itsBit; 		// Follow this up to the root to find the bits associated with this production. 	WordNode theWords; 		// This is the list of words that come from the Production. Variables are at the end. 	ProductionNode next; 		// This is the next in the list. 		 		 		 	public ProductionNode(){ 		probability=1.0; 		itsBit=null; 		theWords=null; 		next=null; 	} 	 	public void setProbability(double d){ 		probability=d; 	} 	 	public void setNext(ProductionNode n){		next =n;	}		public ProductionNode getNext(){		return next;	}		public void setTheWords(WordNode w){		theWords=w;	}}  class VariableNode { 	String w1; 		// This is the identity of the variable. 	ProductionNode productions; 		// This is the list of productions associated with the variable. 	BitNode itsBitRoot; 		// THis is the top of the bit tree. When random characters are being generated, it follows this down to the bottom.} 	VariableNode next; 	 	public VariableNode(){ 		w1=""; 		productions=null; 		itsBitRoot=null; 		next=null; 	} 	 	public void setProductions(ProductionNode p){ 		productions=p; 	} 	 	public ProductionNode getProductions(){ 		return productions; 	} 	 	public void setW1(String w){ 		w1=w; 	}   	public void setNext(VariableNode n){		next =n;	}		public VariableNode getNext(){		return next;	}}    class MimicProdNode{ 	WordNode ww; 	MimicProdNode next; 	 	public  MimicProdNode() { 		ww=null; 		next=null; 	} 	 	 public void setNext(MimicProdNode n){		next =n;	}		public MimicProdNode getNext(){		return next;	}		public void setWW(WordNode a){		ww=a;	}		public WordNode getWW(){		return ww;	}}  class MimicParseFrame {	VariableNode theVariable;	WordNode theWordsToMatch;		// Once a production is matched, this baby is loaded with words to check.			public MimicParseFrame(){		theVariable=null;		theWordsToMatch=null;	}}class NextWordResponse {	String w;	char stopChar;	boolean doubleStop;		public NextWordResponse(String s, char stop, boolean ds){		w=s;		stopChar=stop;		doubleStop=ds;		  // set to be true when we hit a double slash.	}}