moved exprs into nodes with code position

This commit is contained in:
Moritz Gmeiner 2024-08-17 13:32:59 +02:00
commit a8290a4104
6 changed files with 155 additions and 49 deletions

16
lib/value.ml Normal file
View file

@ -0,0 +1,16 @@
type lox_value = String of string | Number of float | Bool of bool | Nil
[@@deriving show { with_path = false }]
let string_of_lox_value lox_value =
match lox_value with
| String s -> s
| Number x -> string_of_float x
| Bool b -> string_of_bool b
| Nil -> "nil"
let type_string_of_lox_value lox_value =
match lox_value with
| String _ -> "String"
| Number _ -> "Number"
| Bool _ -> "Bool"
| Nil -> "Nil"