mirror of
https://github.com/MorizzG/MLox.git
synced 2025-12-06 04:22:41 +00:00
moved exprs into nodes with code position
This commit is contained in:
parent
485ecebdf3
commit
a8290a4104
6 changed files with 155 additions and 49 deletions
16
lib/value.ml
Normal file
16
lib/value.ml
Normal 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"
|
||||
Loading…
Add table
Add a link
Reference in a new issue