⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 实验四.cpp

📁 这是几个编译原理实验程序,有做实验的朋友可以用用!
💻 CPP
字号:
#include<iostream.h>
#include<stdio.h>
main()
{char array[5]={0};
 cout<<:"please input the wen fa: "<<endl;
	 cin<<G[array]<<end;
INITIALIZE();
NEW_NODE();
TEST();
SUCCESS();
FAILURE();
TRY_AGAIN();
cout<<"分析结束时的栈"<<G[array]<<endl;
}
templete <stack_entry>
class stack
{   private:
       int m,n;
	   int maxstack=5;
	 public:
		stack();
		push(&stack);
		void pop(){if(!empty)
			return 1;}
};
stack::stack()
{for(int i=0;i<maxstack;i++)
stack_entrry[i]=stack_entry[i+1];
 return();
};
stack::stack_entry push(&stack)
{if(stack_entry[i]<stack_entry[maxstack])
  return 1;
else
  return 0;
}
INITIALIZE(&stack)
{push(&stack);
 entry[1]=(z,0,0,0,0);
 int c=1;v=1;j=1;
goto FAILURE;
}
NEW_NODE()
{if(key_word>'a'&&keyword<'z')
  if(entry[i]==keyword)
  {j=j+1;goto success;
  }
  else
	  goto FAILURE;
      goto TEST;
}
TEST()
{if(G[i]==|)
if(stack_entry[2]!=0) 
  goto SUCCESS;
else 
  break;
if(stack_entry[i]=$)
if(stack_entry[2]!=0)
 goto failure;
else
 break;
V=V+1;
s[V]=(stack_entry[i],0,c,0,son);
goto NEW_NODE;
}
SUCCESS()
{C=stack_entry[2];
goto TRY_AGAIN;
}
TRY_AGAIN()
{if(stack_entry[4]==0)
{while(stack_entry[i]!=|)
  i=+1;
  goto TEST;
}I
i=i-1;
 C=entry[4];
 if(!(keyword>'a'&&keyword>'z'))
	 gogo TRY_AGAIN;
   j=j-1;
   goto FAILURE;}



 


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -