luau/prototyping/Examples/Syntax.agda
Alan Jeffrey 041838a942
Prototyping a small subset of Luau in Agda (#350)
* First cut reading JSON into an Agda representation of Luau syntax
2022-02-08 18:26:58 -06:00

24 lines
597 B
Agda

module Examples.Syntax where
open import Agda.Builtin.Equality using (_≡_; refl)
open import FFI.Data.String using (_++_)
open import Luau.Syntax using (var; _$_; return; nil; function_⟨_⟩_end; _∙; _∙_)
open import Luau.Syntax.ToString using (exprToString; blockToString)
f = var "f"
x = var "x"
ex1 : exprToString(f $ x)
"f(x)"
ex1 = refl
ex2 : blockToString(return nil )
"return nil"
ex2 = refl
ex3 : blockToString(function "f" "x" return x end return f )
"local function f(x)\n" ++
" return x\n" ++
"end\n" ++
"return f"
ex3 = refl