62,614
社区成员
发帖
与我相关
我的任务
分享
private Stack<Integer> statuStack;
private Stack<Ttuple> tStack;
private TtupleNode curr;
private LinkedList<String> varlist;
public DeclareAnaly(String processFile,String midCodeFile,TtupleNode curr){
this.processFile=processFile;this.midCodeFile=midCodeFile;this.curr=curr;
Stack<Ttuple> tStack=new Stack<Ttuple>();
Stack<Integer> statuStack=new Stack<Integer>();
Stack<String> sStack=new Stack<String>();varlist=new LinkedList<String>();
statuStack.push(0);tStack.push(new Ttuple("start", "#"));sStack.push("#");
}
/**
* analysis the code which to declare variable and save to file
* @param curr the linear of tuple
* @param midCod the filename of file which saved middle code
* @param analyProcess the process of analysis to filename's file
*/
public void analy(){
int i,j;
while(true){
sStack.peek();
i=statuStack.peek();
j=find(curr.element.name, curr.element.value);
if(j<0)
break;
if(move[i][j]==-1&&reduction[i][j]==-1)
{ writeToFile(processFile, "error:"+curr.element.value);;break;}
if(move[i][j]!=-1){
moveToStack(move[i][j], j);
curr=curr.next;
continue;
}
if(reduction[i][j]!=-1){
reduce(reduction[i][j]);
}
}
}