SHARE
TWEET

Untitled

a guest Oct 12th, 2017 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Output when running 'fromFile "ex1.c"':
  2.  
  3.     Prog - Main -> starts the program
  4.     [Fundec - Declaration of a function - Void return type
  5.        (None,"main",[(TypI, "n")], - main function takes n as input
  6.         Block - a sequence of statements
  7.           [Stmt - first statement
  8.              (While - while statement
  9.                 (Prim2 (">",Access (AccVar "n"),CstI 0), - Expression "prim" with expr "access" inside.
  10.                  Block - Statement
  11.  
  12.  
  13.                    // Statement that holds an expr that prints n
  14.                    [Stmt (Expr (Prim1 ("printi",Access (AccVar "n"))));
  15.                     Stmt - Statement
  16.                       (Expr - Expression
  17.                          (Assign - Expression
  18.  
  19.                             // Expr of type ACCESS (more specifically NAME) to access a variable
  20.                             (AccVar "n",Prim2 ("-",Access (AccVar "n"),CstI 1))))]));
  21.  
  22.            // Statement that holds Expr of prim1
  23.            Stmt (Expr (Prim1 ("printc",CstI 10)))])]
RAW Paste Data
Top