原子语句的中间代码 输入输出语句: s→Read()V. tuple (READ, V Arg) S→ Write(E)E. tuple (WRITE, E. Arg) 语法制导: s→Read(V)#READ S→ Write(E)#NR|TE
原子语句的中间代码 输入输出语句: S →Write(E) E.tuple (WRITE, E.Arg); S → Read(V) V.tuple (READ, V.Arg) 语法制导: S → Read(V) #READ S → Write(E) #WRITE
赋值语句: 赋值语句形式: V: =E pt ptr f::=E str 赋值语句的中间代码形式:(AsS|GN,Arg1,Arg2,n) 或(FL0AT,Arg1,Arg2) S→L:=RL. tuple R. tuple (ASSIGN, R, Arg, L Arg, size) E(FLOAt, R Arg, L Arg) 语法制导:S→:=R#ASS|GN
赋值语句: 赋值语句形式: V:=E Vptr:=V1 ptr f:=E Vstr:=V1 str 赋值语句的中间代码形式:(ASSIGN,Arg1,Arg2,n) 或 (FLOAT,Arg1,Arg2) S → L:= R L.tuple R.tuple (ASSIGN, R,Arg, L.Arg, size) 或 (FLOAT, R.Arg, L.Arg) 语法制导: S →L:=R #ASSIGN
过函调用语句 s→id(E1,E2, E1- tuple En tuple (ACT, E. Arg) 传给形参 (ACT, En. Arg) (CALL. <f>, result) 或(GALL,<f)
过函调用语句 S → id(E1,E2,…,En) E1.tuple … En.tuple (ACT,E1.Arg) … (ACT,En.Arg) (CALL,<f>,result) 或(CALL,<f>) 传给形参
形参实参结合中间代码 ( VALACT,E;.Arg, offset;,size1)…值参 ( VARACT,E;,Arg, offset;,size;)…变参 (FUNCACT, E; Arg, offset, s;i ).. 函数参数 (PROACT, E: Arg, offset, size 过程参数 过/函调用代码: (ca|,<f>,true, result)静态转向地址 (ca||,<f>, false, result)动态转向地址
形参实参结合中间代码: (VALACT, Ei.Arg, offseti, sizei)……值参 (VARACT, Ei.Arg, offseti, sizei)……变参 (FUNCACT, Ei.Arg, offseti, sizei)……函数参数 (PROACT, Ei.Arg, offseti, sizei)……过程参数 过/函调用代码: (call ,<f>, true, result) 静态转向地址 (call ,<f>, false, result) 动态转向地址
G0T0语句和标号语句的中间代码 LABEL L1,L2,L空 S->GOTO (JUMP, ARG L S-L. S LABEL, ARG L S tuple
GOTO语句和标号语句的中间代码 LABEL L1 ,L2 ,...,Ln 空 S→GOTO Li (JUMP, ARG(Li ) ) S→Li :S ( LABEL,ARG(Li) ) S.tuple