目录:
Compiler_1:
- 添加编译器识别空语句的功能 eg: read(n);;;;;;;;;;;;;;;;;;;;;
- if-then-else语句 可以允许then后的执行语句为空 eg: if < condition> then < NULL> else < S>
M语言程序示例:
var p,m,n: int;
begin
read(m); read(n);;;;;;;;;;;;;;;;;;;;;;;
p:=0;
if m >n then else p:=2;
write(p)
end@Compiler_2:
- if-then-else语句 若无else条件可省略不写else eg: if < condition> then < S>
M语言程序示例:
var p,m,n: int;
begin
read(m); read(n);
p:=0;
if m >n then p:=1;
write(p)
end@Compiler_3:
- 添加 repeat-until 语法 (即do-while语法)
M语言程序示例:
program
var a,N:int;
begin
a := 0;
read(N);
if(N = 0) then write(N)
else repeat
begin
a:=a+1
end
until a=N;
write(N)
end@Compiler_4:
- 增加数据类型 char
M语言程序示例:
program
var charA, charB : char;
begin
charA := 'x';
read(charB);
if charB>charA then write(charB) else write (charA)
end@
