import Spa.Analysis.Sign
import Spa.Analysis.Constant
import Spa.Language.Notation

namespace Spa

def testCode : Stmt := [obj_stmt|
  zero    := 0;
  pos     := zero + 1;
  neg     := zero - 1;
  unknown := pos + neg
]

def testCodeCond₁ : Stmt := [obj_stmt|
  var := 1;
  if var {
    var := var + 1
  } else {
    var := var - 1;
    var := 1
  }
]

def testCodeCond₂ : Stmt := [obj_stmt|
  var := 1;
  if var { x := 1 } else { noop }
]

def testProgram : Program := { rootStmt := testCode }

end Spa

def main : IO Unit :=
  IO.println (Spa.ConstAnalysis.output Spa.testProgram ++ "\n" ++
              Spa.SignAnalysis.output Spa.testProgram)
