From ee235235b98d01b00de5a446b48d6dec574b1458 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Mon, 24 Oct 2022 17:53:21 -0400 Subject: feat(wpcarro/compiler): Support string literal type ``` repl> "Hello, world" String repl> (fn x "testing") a0 -> String ``` Change-Id: Ia76299a56aa4d2032c9a21277e2fddfb2e055831 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7079 Tested-by: BuildkiteCI Reviewed-by: wpcarro --- users/wpcarro/scratch/compiler/types.ml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'users/wpcarro/scratch/compiler/types.ml') diff --git a/users/wpcarro/scratch/compiler/types.ml b/users/wpcarro/scratch/compiler/types.ml index 79c51c6812..0acd05737c 100644 --- a/users/wpcarro/scratch/compiler/types.ml +++ b/users/wpcarro/scratch/compiler/types.ml @@ -1,4 +1,7 @@ -type literal = LiteralInt of int | LiteralBool of bool +type literal + = LiteralInt of int + | LiteralBool of bool + | LiteralString of string (* Lambda Calculus definition *) type value = @@ -14,6 +17,7 @@ module FromString = Map.Make (String) type _type = | TypeInt | TypeBool + | TypeString | TypeVariable of string | TypeArrow of _type * _type -- cgit 1.4.1