Version française
Home     About     Download     Resources     Contact us    
Browse thread
Toplevel function question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: MONATE Benjamin 205998 <Benjamin.MONATE@c...>
Subject: RE :_[Caml-list]_Re:_Toplevel_function_question
Hi,

The last "let" is missing its corresponding "in".
 let _ =
  let lexbuf = Lexing.from_channel stdin in
  let rec storeoriginalprogram =
    let expr = lexbuf in
    match expr with
    | EOF   -> ()
    | _     -> (add_text originalprogramcontents expr); storeoriginalprogram
  in let parseprogram = List.iter
    (fun n -> print_string n; print_string "\n";) originalprogramcontents
  in parsepreogram

You may also remove the last "let": 

let _ =
  let lexbuf = Lexing.from_channel stdin in
  let rec storeoriginalprogram =
    let expr = lexbuf in
    match expr with
    | EOF   -> ()
    | _     -> (add_text originalprogramcontents expr); storeoriginalprogram
  in 
  List.iter
    (fun n -> print_string n; print_string "\n";) originalprogramcontents

Hope this helps.
--
Benjamin Monate
CEA LIST
Head of Software Safety Lab.