pep8analysis: fix format and encoding of some sample/test programs
[nit.git] / contrib / pep8analysis / tests / privat / 06-calc-non-pur.pep
1 ; Semaine 6
2 ; Programme non pur qui fait des opérations multiples
3 ; Jean Privat (C) 2010
4          DECI    num,d       
5          LDX     num,d       ; X = nombre opération = getNombre();
6          CHARI   op,d        
7          LDA     0,i         
8          LDBYTEA op,d        ; A = op = getChar()
9          CPA     '+',i       ; if (A == '+') ;
10          BREQ    loop        
11          CPA     '-',i       
12          BRNE    error       ; else if (A == '-') {
13          LDBYTEA subad,d     
14          STBYTEA instr,d     ;   remplace l'instruction à instr par SUBA
15          BR      loop        ; } else {
16 error:   STRO    errMsg,d    ;   print error;
17          STOP                ;   exit; }
18 loop:    SUBX    1,i         ; while(--X >= 0) {
19          BRLT    fin         
20          DECI    num,d       
21          LDA     num,d       
22          DECI    num,d       
23 instr:   ADDA    num,d       ;   num = getInt() + getInt() // ou - si remplassage
24          STA     num,d       
25          DECO    num,d       
26          CHARO   '\n',i      ;   print(num, "\n")
27          BR      loop        ; } // fin while
28 fin:     STOP                
29 op:      .BLOCK  1           ; #1c symbole de l'opération
30 num:     .BLOCK  2           ; nombre entrée, calculé et affiché
31 errMsg:  .ASCII  "Attendu '+' ou '-'\x00"
32 subad:   SUBA    0,d         ; code opération instruction
33          .END