2022-02-10 07:14:29 +08:00
|
|
|
{-# OPTIONS --rewriting #-}
|
|
|
|
|
|
|
|
module Examples.Run where
|
|
|
|
|
|
|
|
open import Agda.Builtin.Equality using (_≡_; refl)
|
2022-02-25 03:17:46 +08:00
|
|
|
open import Agda.Builtin.Bool using (true; false)
|
2022-03-03 07:26:58 +08:00
|
|
|
open import Luau.Syntax using (nil; var; _$_; function_is_end; return; _∙_; done; _⟨_⟩; number; binexp; +; <; val; bool; ~=; string)
|
2022-02-10 07:14:29 +08:00
|
|
|
open import Luau.Run using (run; return)
|
|
|
|
|
2022-03-03 06:02:51 +08:00
|
|
|
ex1 : (run (function "id" ⟨ var "x" ⟩ is return (var "x") ∙ done end ∙ return (var "id" $ val nil) ∙ done) ≡ return nil _)
|
2022-02-10 07:14:29 +08:00
|
|
|
ex1 = refl
|
2022-02-19 03:09:00 +08:00
|
|
|
|
2022-03-03 06:02:51 +08:00
|
|
|
ex2 : (run (function "fn" ⟨ var "x" ⟩ is return (val (number 123.0)) ∙ done end ∙ return (var "fn" $ val nil) ∙ done) ≡ return (number 123.0) _)
|
2022-02-19 03:09:00 +08:00
|
|
|
ex2 = refl
|
2022-02-23 07:52:56 +08:00
|
|
|
|
2022-03-03 06:02:51 +08:00
|
|
|
ex3 : (run (function "fn" ⟨ var "x" ⟩ is return (binexp (val (number 1.0)) + (val (number 2.0))) ∙ done end ∙ return (var "fn" $ val nil) ∙ done) ≡ return (number 3.0) _)
|
2022-02-23 07:52:56 +08:00
|
|
|
ex3 = refl
|
2022-02-25 03:17:46 +08:00
|
|
|
|
2022-03-03 06:02:51 +08:00
|
|
|
ex4 : (run (function "fn" ⟨ var "x" ⟩ is return (binexp (val (number 1.0)) < (val (number 2.0))) ∙ done end ∙ return (var "fn" $ val nil) ∙ done) ≡ return (bool true) _)
|
2022-02-25 03:17:46 +08:00
|
|
|
ex4 = refl
|
2022-03-03 07:26:58 +08:00
|
|
|
|
|
|
|
ex5 : (run (function "fn" ⟨ var "x" ⟩ is return (binexp (val (string "foo")) ~= (val (string "bar"))) ∙ done end ∙ return (var "fn" $ val nil) ∙ done) ≡ return (bool true) _)
|
|
|
|
ex5 = refl
|