From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 350DA7F84F for ; Sun, 23 Feb 2014 14:12:46 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of tcui@janestreet.com) identity=pra; client-ip=38.105.200.229; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="tcui@janestreet.com"; x-sender="tcui@janestreet.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of tcui@janestreet.com designates 38.105.200.229 as permitted sender) identity=mailfrom; client-ip=38.105.200.229; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="tcui@janestreet.com"; x-sender="tcui@janestreet.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@tot-dmz-mxout1.janestreet.com) identity=helo; client-ip=38.105.200.229; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="tcui@janestreet.com"; x-sender="postmaster@tot-dmz-mxout1.janestreet.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqYBADTzCVMmacjlnGdsb2JhbABZg0FXqjuNTIhWfh4OAQEBAQEGFgk8giUBAQQBJxkBASwLAQQLCwQHGiEhARIBBQEKEgYTEodfAwkIAwIImkeLFYRXAQWVYQMKhzIRBoxPghEEB4Q4iUqNAYFtgTKLLoNaGCmEZg X-IPAS-Result: AqYBADTzCVMmacjlnGdsb2JhbABZg0FXqjuNTIhWfh4OAQEBAQEGFgk8giUBAQQBJxkBASwLAQQLCwQHGiEhARIBBQEKEgYTEodfAwkIAwIImkeLFYRXAQWVYQMKhzIRBoxPghEEB4Q4iUqNAYFtgTKLLoNaGCmEZg X-IronPort-AV: E=Sophos;i="4.97,529,1389740400"; d="scan'208";a="50135105" Received: from mx5.janestreet.com (HELO tot-dmz-mxout1.janestreet.com) ([38.105.200.229]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 23 Feb 2014 14:12:45 +0100 Received: from tot-oib-smtp1.delacy.com ([172.27.22.15] helo=tot-smtp) by tot-dmz-mxout1.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1WHYrJ-0002DE-MZ for caml-list@inria.fr; Sun, 23 Feb 2014 08:12:41 -0500 Received: from tot-dmz-mxgoog1.delacy.com ([172.27.224.14] helo=mxgoog2.janestreet.com) by tot-smtp with esmtps (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1WHYrJ-0001Rx-LI for caml-list@inria.fr; Sun, 23 Feb 2014 08:12:41 -0500 Received: from mail-wi0-f180.google.com ([209.85.212.180]) by mxgoog2.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1WHYrJ-0006ei-Ba for caml-list@inria.fr; Sun, 23 Feb 2014 08:12:41 -0500 Received: by mail-wi0-f180.google.com with SMTP id hm4so2178418wib.1 for ; Sun, 23 Feb 2014 05:12:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=1sOfwdF15LwHlWeZOIZiqgpRVjdElDpC91TdDCMIOX8=; b=VevLG91T9YMLMAp55wm8qy0yjepR63p8GBGrsCx0mYR5CrlhA0M3/qGxmo/OgZ6c4M V9KaYsLvfFlkWgxNQXdafNn9Vrcuh6pWUrAyXKLSjkn9QWXBfaJYIqBQHdkKO6Qf4+MV vbDnQwsva8BuZBfEmd6CAwDHWnpR0trNvmivU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=1sOfwdF15LwHlWeZOIZiqgpRVjdElDpC91TdDCMIOX8=; b=XdNlNycmMyf70KMLX5wh7UdiSk4jnYUUcwYzCi41g10FTgjacppgT8rt2n0zVzD/cZ gEIvP1GP1Kf4PqVz6/BLYG8+oQaMcIs24XQlA3Ou5vCCfUr8j6O5z8B0NjpWLDsZqyXA yDWj7pfb1dE8iw9YXYg9IMK2hUWNZwzf68+O9Q9PbltRzyz1xlVmOPPruKQXxnvJGrCr 0gHvG6e7VEJcgXWsBzTaFdoYjNwhqmlKApWkMAZA9+wgd9DJOAES9Gshhx0e/oLFHjuQ ym0S2LqSLzSEpg3J97fCZYEjbSaNU78eIM3KMU93JfwYiEWWURVWNE7JMI1PxXAqGFmG pDCw== X-Gm-Message-State: ALoCoQlzMp2C6ANOGQplIwjZkZdmfEXPvVvgrmU0IDArW1srMwcIy5qfXe1RB06Vg+pZyxy75Y3JtUmZm8cfAzJo7t/kmOjEkURY7XP7TgB+zgAWtbxJZ6f/KdSA9y1+kcgZlthLUx6Sb7mEFuQmsV64bgq5sLt0Wg== X-Received: by 10.194.57.140 with SMTP id i12mr13986897wjq.20.1393161160875; Sun, 23 Feb 2014 05:12:40 -0800 (PST) X-Received: by 10.194.57.140 with SMTP id i12mr13986889wjq.20.1393161160772; Sun, 23 Feb 2014 05:12:40 -0800 (PST) MIME-Version: 1.0 Received: by 10.194.110.134 with HTTP; Sun, 23 Feb 2014 05:12:00 -0800 (PST) In-Reply-To: <5309E82E.5060802@gmail.com> References: <5309E82E.5060802@gmail.com> From: Tianyi Cui Date: Sun, 23 Feb 2014 21:12:00 +0800 Message-ID: To: Matej Kosik <5764c029b688c1c0d24a2e97cd764f@gmail.com> Cc: caml-list@inria.fr Content-Type: multipart/alternative; boundary=047d7ba97d0e1a60e704f3129cdf X-Sender-Copy: hkg-copy Subject: Re: [Caml-list] how to convert strings to Ocaml values at run-time? --047d7ba97d0e1a60e704f3129cdf Content-Type: text/plain; charset=ISO-8859-1 If you know the type of this string in advance, you can do so with ocaml_plugin: https://github.com/janestreet/ocaml_plugin On Sun, Feb 23, 2014 at 8:23 PM, Matej Kosik < 5764c029b688c1c0d24a2e97cd764f@gmail.com> wrote: > Hi, > > I would like to ask, what is the easiest way how to: > - take given string, provided by the user at run time > - run it through lexer --> parser --> check given value, in the current > context, has a given type > - and bind the value to a variable (provided there were no > lexing/parsing/typechecking problems). > > (I am not yet 100% sure, that this is the right direction to solve my > problem, but I am quite interested whether I could solve it this way.) > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > --047d7ba97d0e1a60e704f3129cdf Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
If you know the type of this string in advance, you can do= so with ocaml_plugin: https://github.com/janestreet/ocaml_plugin


On Sun, Feb 23, 2014 at 8:23 PM, Matej K= osik <5764c029b688c1c0d24a2e97cd764f@gmail.com&= gt; wrote:
Hi,

I would like to ask, what is the easiest way how to:
- take given string, provided by the user at run time
- run it through lexer --> parser --> check given value, in the curre= nt context, has a given type
- and bind the value to a variable (provided there were no lexing/parsing/t= ypechecking problems).

(I am not yet 100% sure, that this is the right direction to solve my probl= em, but I am quite interested whether I could solve it this way.)

--
Caml-list mailing list. =A0Subscription management and archives:
ht= tps://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

--047d7ba97d0e1a60e704f3129cdf--