analyzestack.java
来自「编译器」· Java 代码 · 共 56 行
JAVA
56 行
package compiler;
import java.util.Vector;
public class AnalyzeStack
{
public static Vector<Integer> state;
public static Vector<Integer> symbol;
public static int statop;
public static int symtop;
public AnalyzeStack()
{
state = new Vector<Integer>();
symbol = new Vector<Integer>();
state.add(0);
symbol.add(18);
statop = 1;
symtop = 1;
}
//////////////对状态栈的操作//////////////////////
public int getState()
{
return state.get(statop-1);
}
public void pushState(int sta)
{
state.add(sta);
statop++;
}
public int popState()
{
int x;
x = state.remove(--statop);
return x;
}
//////////////对符号栈的操作//////////////////////
public int getSymbol()
{
return symbol.get(symtop-1);
}
public void pushSymbol(int sym)
{
symbol.add(sym);
symtop++;
}
public int popSymbol()
{
int x;
x = symbol.remove(--symtop);
return x;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?