Sh-Zh-7 / CMinus

💻 A naïve compilation principal course design.
Do What The F*ck You Want To Public License
2 stars 0 forks source link

[test] CMinus code example3. #20

Open Sh-Zh-7 opened 3 years ago

Sh-Zh-7 commented 3 years ago
int inc()
{
    int i;
    i = i + 1;
}
github-actions[bot] commented 3 years ago

Compile successfully. The result is:

Program(1)
  ExtDefList(1)
    ExtDef(1)
      Specifier(1)
        TYPE: int
      FunDec(1)
        ID: inc
        LP
        RP
      CompSt(2)
        LC
        DefList(3)
          Def(3)
            Specifier(3)
              TYPE: int
            DecList(3)
              Dec(3)
                VarDec(3)
                  ID: i
            SEMI
        StmtList(4)
          Stmt(4)
            Exp(4)
              Exp(4)
                ID: i
              ASSIGNOP
              Exp(4)
                Exp(4)
                  ID: i
                PLUS
                Exp(4)
                  INT: 1
            SEMI
        RC