图8.11用数值表示布尔值的翻译方案 |
E→E1 or E2
{E.place∶=newtemp;
emit(E.place′∶=′E1.place ′or′E2.place)}
E→E1 and E2
{E.place∶ =newtemp;
emit(E.place′∶=′E1.place ′and′E2.place)}
E→not E1
{E.place∶ =newtemp:;
emit(E.place′∶=′not′E1.place)}
E→(E1)
{E.place∶=E1.place}
E→id1 relop id2
{E.place∶=newtemp;
emit(′if′id1.place relop id2.place′goto′ nextstat+3);
emit(E.place′∶=′′0′);
emit(′goto′nextstat+2);
emit(E.place′∶=′′1′)}
E→true
{E.place∶=newtemp;
emit(E.place′∶=′′1′)}
E→false
{E.place∶=newtemp;
emit(E.place′∶=′′0′)} |
|