From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.8 required=5.0 tests=DNS_FROM_RFC_POST,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id D95FBBC37 for ; Thu, 14 May 2009 09:52:26 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmwCALxqC0rRVdvgmGdsb2JhbACWXD8BAQEBAQgJDAcRpWOBEo9rAQMBA4N/BQ X-IronPort-AV: E=Sophos;i="4.38,431,1233529200"; d="scan'208";a="29282393" Received: from mail-ew0-f224.google.com ([209.85.219.224]) by mail1-smtp-roc.national.inria.fr with ESMTP; 14 May 2009 09:52:26 +0200 Received: by ewy24 with SMTP id 24so1464450ewy.27 for ; Thu, 14 May 2009 00:52:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=hsxaA7sNTUPfR3Mj2NLoBMhdJTxV2taSq+Xu69zD/bs=; b=wJwGmf5cn1nI4nK/4vppbIUv0gjWbO/Npr0Lqym9S4rE3+bKgCAf17map5NLknpzAy hTW87hgr/RxdLJNsF9m5Sca2RnyA4YKCXeBXzz4Vbnfhb9SrkJ/dhgXPOznin5T3i4T0 3FqbdusLYbn+718o7dbnB+WvylWmIUf/yvYC8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=JGL1FjkzrMmttukknuSdpycsalSZ7y/3a4VggWuir8qdx7e7mfmnlOKuyDvHs1kI71 CDmUxrb73orGoVP0gpUd3nNzGIDuuOiFeCbd2rmJk9s4b/wkW+ZcC70HiUPrv9TWcB74 ruZGdNf+edAGr0VCeVZ1SxeM007pKC5y6PT/A= Received: by 10.210.43.11 with SMTP id q11mr1826017ebq.37.1242287545883; Thu, 14 May 2009 00:52:25 -0700 (PDT) Received: from ?10.0.0.2? (APuteaux-152-1-5-230.w82-120.abo.wanadoo.fr [82.120.35.230]) by mx.google.com with ESMTPS id 7sm1504720eyb.25.2009.05.14.00.52.24 (version=SSLv3 cipher=RC4-MD5); Thu, 14 May 2009 00:52:25 -0700 (PDT) Message-ID: <4A0BCDB4.10105@gmail.com> Date: Thu, 14 May 2009 09:52:20 +0200 From: Gregory BELLIER User-Agent: Thunderbird 2.0.0.21 (X11/20090318) MIME-Version: 1.0 To: Joel Christner Cc: caml-list Subject: Re: [Caml-list] Re: Toplevel function question References: <9da743ed0905131643t98cd36co1f00498434be3c3c@mail.gmail.com> <9da743ed0905131710w5563de39i60f1d60c071ff515@mail.gmail.com> In-Reply-To: <9da743ed0905131710w5563de39i60f1d60c071ff515@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Spam: no; 0.00; toplevel:01 syntax:01 lexbuf:01 lexing:01 stdin:01 expr:01 lexbuf:01 expr:01 iter:01 val:01 val:01 rec:01 rec:01 caml-list:01 compiling:02 Hello ! Joel Christner a écrit : > Simpler representation - tried compiling this and got the same syntax > error - at a line number that was after the EOF. Thanks in advance > for any help!! > > let add_text variablelist text = > variablelist.contents <- text::variablelist.contents > Please refer to the last email from John Li. variablelist := test :: !variablelist > let originalprogramcontents = ref [""] > > 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 Here you should call _*!*_originalprogramcontents which seems to be empty with your example because you declare the function storeoriginalprogram but you don't use/call it. Try something like : let myvariable = 1 in let rec fun var = match var with | val1 -> ... | val2 -> ... | _ -> ... in fun my_variable ( <<--- this is what you forgot ) Gregory.