2024-03-11 13:07:42 -07:00
|
|
|
|
module Main where
|
|
|
|
|
|
|
|
|
|
open import Language
|
|
|
|
|
open import Analysis.Sign
|
|
|
|
|
open import Data.Vec using (Vec; _∷_; [])
|
|
|
|
|
open import IO
|
|
|
|
|
open import Level using (0ℓ)
|
|
|
|
|
|
2024-04-13 14:13:44 -07:00
|
|
|
|
testCode : Stmt
|
2024-03-11 13:07:42 -07:00
|
|
|
|
testCode =
|
2024-04-13 14:13:44 -07:00
|
|
|
|
⟨ "zero" ← (# 0) ⟩ then
|
|
|
|
|
⟨ "pos" ← ((` "zero") Expr.+ (# 1)) ⟩ then
|
|
|
|
|
⟨ "neg" ← ((` "zero") Expr.- (# 1)) ⟩ then
|
|
|
|
|
⟨ "unknown" ← ((` "pos") Expr.+ (` "neg")) ⟩
|
2024-03-11 13:07:42 -07:00
|
|
|
|
|
2024-05-08 23:30:23 -07:00
|
|
|
|
testCodeCond₁ : Stmt
|
|
|
|
|
testCodeCond₁ =
|
|
|
|
|
⟨ "var" ← (# 1) ⟩ then
|
|
|
|
|
if (` "var") then (
|
|
|
|
|
⟨ "var" ← ((` "var") Expr.+ (# 1)) ⟩
|
|
|
|
|
) else (
|
|
|
|
|
⟨ "var" ← ((` "var") Expr.- (# 1)) ⟩ then
|
|
|
|
|
⟨ "var" ← (# 1) ⟩
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
testCodeCond₂ : Stmt
|
|
|
|
|
testCodeCond₂ =
|
|
|
|
|
⟨ "var" ← (# 1) ⟩ then
|
|
|
|
|
if (` "var") then (
|
|
|
|
|
⟨ "x" ← (# 1) ⟩
|
|
|
|
|
) else (
|
|
|
|
|
⟨ noop ⟩
|
|
|
|
|
)
|
|
|
|
|
|
2024-03-11 13:07:42 -07:00
|
|
|
|
testProgram : Program
|
|
|
|
|
testProgram = record
|
2024-04-13 14:13:44 -07:00
|
|
|
|
{ rootStmt = testCode
|
2024-03-11 13:07:42 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
open WithProg testProgram using (output)
|
|
|
|
|
|
|
|
|
|
main = run {0ℓ} (putStrLn output)
|