-
Notifications
You must be signed in to change notification settings - Fork 391
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prototype bools and relational operators (#387)
Prototypes booleans and relational operators. As part of this I removed `FFI/Data/Bool.agda`, because it was getting in the way - we already use `Agda.Builtin.Bool` instead for other cases.
- Loading branch information
1 parent
0bc7c51
commit 0bd2176
Showing
19 changed files
with
142 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
module Luau.RuntimeType where | ||
|
||
open import Luau.Value using (Value; nil; addr; number) | ||
open import Luau.Value using (Value; nil; addr; number; bool) | ||
|
||
data RuntimeType : Set where | ||
function : RuntimeType | ||
number : RuntimeType | ||
nil : RuntimeType | ||
boolean : RuntimeType | ||
|
||
valueType : Value → RuntimeType | ||
valueType nil = nil | ||
valueType (addr x) = function | ||
valueType (number x) = number | ||
valueType (bool _) = boolean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
module Luau.RuntimeType.ToString where | ||
|
||
open import FFI.Data.String using (String) | ||
open import Luau.RuntimeType using (RuntimeType; function; number; nil) | ||
open import Luau.RuntimeType using (RuntimeType; function; number; nil; boolean) | ||
|
||
runtimeTypeToString : RuntimeType → String | ||
runtimeTypeToString function = "function" | ||
runtimeTypeToString number = "number" | ||
runtimeTypeToString nil = "nil" | ||
runtimeTypeToString boolean = "boolean" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
module Luau.Value where | ||
|
||
open import Agda.Builtin.Bool using (Bool; true; false) | ||
open import Agda.Builtin.Float using (Float) | ||
open import Luau.Addr using (Addr) | ||
open import Luau.Syntax using (Block; Expr; nil; addr; number) | ||
open import Luau.Syntax using (Block; Expr; nil; addr; number; true; false) | ||
open import Luau.Var using (Var) | ||
|
||
data Value : Set where | ||
nil : Value | ||
addr : Addr → Value | ||
number : Float → Value | ||
bool : Bool → Value | ||
|
||
val : ∀ {a} → Value → Expr a | ||
val nil = nil | ||
val (addr a) = addr a | ||
val (number x) = number x | ||
val (bool false) = false | ||
val (bool true) = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
return true == false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
return 1 == 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module Utility.Bool where | ||
|
||
open import Agda.Builtin.Bool using (Bool; true; false) | ||
|
||
not : Bool → Bool | ||
not false = true | ||
not true = false | ||
|
||
_or_ : Bool → Bool → Bool | ||
true or _ = true | ||
_ or true = true | ||
_ or _ = false | ||
|
||
_and_ : Bool → Bool → Bool | ||
true and true = true | ||
_ and _ = false |