From c530682030e80ee2de2c263471e5eda7a3392e84 Mon Sep 17 00:00:00 2001 From: Marcos Magueta Date: Sat, 11 Jul 2026 03:07:56 -0300 Subject: working vm: parser, admission with totality checks, solver and repl --- lib/front.ml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lib/front.ml (limited to 'lib/front.ml') diff --git a/lib/front.ml b/lib/front.ml new file mode 100644 index 0000000..7cacc20 --- /dev/null +++ b/lib/front.ml @@ -0,0 +1,14 @@ +let parse_string source = + let lexbuf = Lexing.from_string source in + match Parser.program Lexer.token lexbuf with + | statements -> Ok statements + | exception Lexer.Error message -> + let position = lexbuf.Lexing.lex_curr_p in + Error + (Printf.sprintf "lexical error at line %d: %s" + position.Lexing.pos_lnum message) + | exception Parser.Error -> + let position = lexbuf.Lexing.lex_curr_p in + Error + (Printf.sprintf "syntax error at line %d, before %S" + position.Lexing.pos_lnum (Lexing.lexeme lexbuf)) -- cgit v1.2.3