Skip to content

Commit

Permalink
feat(parser-tests): add function for test parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
ksenmel committed Nov 18, 2024
1 parent ea61bd9 commit ae47417
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/parser/parser.ml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,9 @@ let declaration_parser =
let parse input =
parse_string ~consume:All (many1 (expression_parser <|> declaration_parser)) input
;;

let test_parse code =
match parse code with
| Ok ast -> Stdlib.Format.printf "%a\n" Ast.pp_program ast
| Error s -> Stdlib.Format.printf "Parsing error: %s\n" s
;;

0 comments on commit ae47417

Please sign in to comment.