diff options
Diffstat (limited to '')
| -rw-r--r-- | lib/dcl/parser.ml | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/dcl/parser.ml b/lib/dcl/parser.ml new file mode 100644 index 0000000..a7981c0 --- /dev/null +++ b/lib/dcl/parser.ml @@ -0,0 +1,9 @@ +type error = ParseError of string + +let of_string s = + match Sexplib.Sexp.of_string s |> Ast.statement_of_sexp with + | stmt -> Ok stmt + | exception exn -> Error (ParseError (Printexc.to_string exn)) + +let to_string stmt = + Ast.sexp_of_statement stmt |> Sexplib.Sexp.to_string_hum |
