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

📄 legal-10

📁 用Java实现的编译器。把源代码编译成SPARC汇编程序
💻
字号:
class Program{  int x,y;  int m1(int x)  {	//shadows global x as formal        int ret;	ret=x;	x=100;	return ret-1;  }  int m2(int n)  {	//shadow global by local        int x;	x=n+1000;	return x;  }  int m3(int n)  {	//write to global in proc and main        x=4;	y=n; 	return y-100;  }    void main()  {     int res;        x=2;	res = m1(x);	if (x==2 && res==1) 	{ 		callout("printf","shadow by formal OK\n"); 	}	else 	{		callout("printf","FAIL: shadow by formal: %d %d\n",x,y);	}        x=2;	res = m2(x);	if (x==2 && res==1002) 	{		callout("printf","shadow by local OK\n");	}	else 	{ 		callout("printf","FAIL: shadow by local: %d %d\n",x,y);	}         	x=2;	y=3;        y = m3(y+100) + (y-50);	if (x==4 && y==56) 	{		callout("printf","proc sideeffect OK\n");	}	else 	{		callout("printf","FAIL: proc sideeffect in first operand: %d %d\n",x,y);	}  }}

⌨️ 快捷键说明

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