mirror of
https://github.com/MorizzG/MLox.git
synced 2025-12-06 04:22:41 +00:00
16 lines
426 B
OCaml
16 lines
426 B
OCaml
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"
|