2022-02-09 23:14:29 +00:00
|
|
|
{-# OPTIONS --rewriting #-}
|
|
|
|
|
|
|
|
module Examples.Run where
|
|
|
|
|
|
|
|
open import Agda.Builtin.Equality using (_≡_; refl)
|
2022-02-22 23:52:56 +00:00
|
|
|
open import Luau.Syntax using (nil; var; _$_; function_is_end; return; _∙_; done; _⟨_⟩; number; binexp; +)
|
2022-02-18 19:09:00 +00:00
|
|
|
open import Luau.Value using (nil; number)
|
2022-02-09 23:14:29 +00:00
|
|
|
open import Luau.Run using (run; return)
|
2022-02-12 01:03:26 +00:00
|
|
|
open import Luau.Heap using (lookup-next; next-emp; lookup-next-emp)
|
2022-02-09 23:14:29 +00:00
|
|
|
|
|
|
|
import Agda.Builtin.Equality.Rewrite
|
|
|
|
{-# REWRITE lookup-next next-emp lookup-next-emp #-}
|
|
|
|
|
2022-02-12 01:03:26 +00:00
|
|
|
ex1 : (run (function "id" ⟨ var "x" ⟩ is return (var "x") ∙ done end ∙ return (var "id" $ nil) ∙ done) ≡ return nil _)
|
2022-02-09 23:14:29 +00:00
|
|
|
ex1 = refl
|
2022-02-18 19:09:00 +00:00
|
|
|
|
|
|
|
ex2 : (run (function "fn" ⟨ var "x" ⟩ is return (number 123.0) ∙ done end ∙ return (var "fn" $ nil) ∙ done) ≡ return (number 123.0) _)
|
|
|
|
ex2 = refl
|
2022-02-22 23:52:56 +00:00
|
|
|
|
|
|
|
ex3 : (run (function "fn" ⟨ var "x" ⟩ is return (binexp (number 1.0) + (number 2.0)) ∙ done end ∙ return (var "fn" $ nil) ∙ done) ≡ return (number 3.0) _)
|
|
|
|
ex3 = refl
|