以下内容仅为个人学习笔记,非正规教程,难免有疏漏之处,请指出!
目标要分析词法的对象是一种叫TINY+的计算机语言。下面是一个Example,
char str;
int x, fact;
str:= 'sample program in TINY+ language- computes factorial';
read x;
if x>0 and x<100 then {don’t compute if x<=0}
fact:=1;
while x>0 do
fact:=fact*x;
x:=x-1
end;
write fact
end