OCaml: Add a configuration lexer

This commit is contained in:
Juno Takano 2025-04-30 19:46:12 -03:00
commit 902734d610
4 changed files with 129 additions and 2 deletions

View file

@ -0,0 +1,8 @@
let chars_of_string (string: string): char list =
let rec split string index chars =
if index = String.length string then chars
else split string (index + 1) (string.[index] :: chars)
in List.rev (split string 0 [])
let string_of_chars (chars: char list): string =
String.concat "" (List.map (String.make 1) chars)