feat: Support basic expression

This commit is contained in:
Lucàs
2024-07-02 15:33:58 +02:00
parent c91951308f
commit e563bce4f5
12 changed files with 231 additions and 25 deletions
+4 -2
View File
@@ -1,4 +1,6 @@
;bin/dune
(executable
(public_name croissant)
(name main)
(libraries croissant))
(public_name croissant)
(libraries parser lexer ast))
+19 -1
View File
@@ -1 +1,19 @@
let () = print_endline "Hello, World!"
(* bin/main.ml *)
open Printf
open Ast
let () =
let lexbuf = Lexing.from_channel stdin in
let res =
try Parser.main Lexer.token lexbuf with
| Lexer.Error c ->
fprintf stderr "Lexical error at line %d: Unknown character '%c'\n"
lexbuf.lex_curr_p.pos_lnum c;
exit 1
| Parser.Error ->
fprintf stderr "Parse error at line %d:\n" lexbuf.lex_curr_p.pos_lnum;
exit 1
in
let _ = res in
Printf.printf "%s\n" (string_of_source_file res)