Cool(程序编制个言话)
外观
Cool———是英文个缩写词:Classroom Object Oriented Langage
该是1996年由大仲马•艾肯(Alexander Aiken)受到Java/ML/Pascal/C++搿星程序编制言话个启发发明出来个新型言话。
程序个实例
[编辑]class Main : IO is
Main() begin
out_string("Enter an integer greater-than or equal-to 0: ");
let input: Integer := in_int(); in
if input < 0 then
out_string("ERROR: Number must be greater-than or equal-to 0\n")
else
out_string("The factorial of ").out_int(input);
out_string(" is ").out_int(factorial(input))
fi
end
end;
factorial(num: Integer): Integer := if num = 0 then 1 else num + factorial(num - 1) fi;
end;
参考文献
[编辑]- Cool: A Portable Project for Teaching Compiler Construction
- CoolAid: The Cool 2008 Reference Manual 档案,存勒互联网档案馆当中。(2010年10月8号)
- (Un)CoolAid: The UnCool Reference Manual 档案,存勒互联网档案馆当中。(2007年12月26号)
外部链接
[编辑]Cool: The Classroom Object-Oriented Language 档案,存勒互联网档案馆当中。(2008年12月6号) project main page