43 lines
960 B
Agda
43 lines
960 B
Agda
module Main where
|
||
|
||
open import Language
|
||
open import Analysis.Sign
|
||
open import Data.Vec using (Vec; _∷_; [])
|
||
open import IO
|
||
open import Level using (0ℓ)
|
||
|
||
testCode : Stmt
|
||
testCode =
|
||
⟨ "zero" ← (# 0) ⟩ then
|
||
⟨ "pos" ← ((` "zero") Expr.+ (# 1)) ⟩ then
|
||
⟨ "neg" ← ((` "zero") Expr.- (# 1)) ⟩ then
|
||
⟨ "unknown" ← ((` "pos") Expr.+ (` "neg")) ⟩
|
||
|
||
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 ⟩
|
||
)
|
||
|
||
testProgram : Program
|
||
testProgram = record
|
||
{ rootStmt = testCode
|
||
}
|
||
|
||
open WithProg testProgram using (output)
|
||
|
||
main = run {0ℓ} (putStrLn output)
|