Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- +
- +
- let to_string = function
- | PLUS -> sprintf "PLUS"
- | STRING (str) -> sprintf "STRING(%s)" (str)
- + | INT (d) -> sprintf "INT(%d)" (d)
- + | MINUS -> sprintf "MINUS"
- + | TIMES -> sprintf "TIMES"
- + | _ -> "some shit"
- ;;
- let main () =
- let lexbuf = set_filename "stdin" @@ L.from_channel stdin in
- let rec loop acc = function
- | EOF -> to_string EOF :: acc |> List.rev
- | x -> loop (to_string x :: acc) (mainlex lexbuf)
- in
- loop [] (mainlex lexbuf)
- |> String.concat " "
- |> print_endline
- +
- + let () = main ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement