From: Evgeny Roubinchtein <zhenya1007@gmail.com>
To: Umair Siddique <umair.hvg@gmail.com>
Cc: OCaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] Reading Custom Type
Date: Thu, 29 Jun 2017 11:36:25 -0400 [thread overview]
Message-ID: <CAGYXaSZU24UTdZFQ-GzwkRMe-UVSakDg3hy0bfiEBN003hc9Hw@mail.gmail.com> (raw)
In-Reply-To: <CAFJB9SF2WT19_HjvPevOE4OPmJS_+6d4ZcpqiWxZqYCiFu64YQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 895 bytes --]
You need a parser for the printed representation of your type. There are
many sources of information on parsing in OCaml, for example:
https://realworldocaml.org/v1/en/html/parsing-with-ocamllex-and-menhir.html,
https://caml.inria.fr/pub/docs/oreilly-book/html/book-ora103.html; if you
have a copy of "The Functional Approach To Programming" parsing is covered
there also. As a shortcut, you _may_ be able to use sexp-lib to
automagically create a parser for you; sexp-lib is covered in
https://realworldocaml.org/v1/en/html/data-serialization-with-s-expressions.html
.
--
Best,
Zhenya
On Thu, Jun 29, 2017 at 11:24 AM, Umair Siddique <umair.hvg@gmail.com>
wrote:
> Hi all,
>
> Can someone indicate me the best way to read custom type from a file or
> from command line.
>
> for example, type abc = Awsome | Great ;;
>
> I want to read it from a file or command line
>
>
> Thanks
>
> Uma
>
[-- Attachment #2: Type: text/html, Size: 1656 bytes --]
prev parent reply other threads:[~2017-06-29 15:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-29 15:24 Umair Siddique
2017-06-29 15:36 ` Evgeny Roubinchtein [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAGYXaSZU24UTdZFQ-GzwkRMe-UVSakDg3hy0bfiEBN003hc9Hw@mail.gmail.com \
--to=zhenya1007@gmail.com \
--cc=caml-list@inria.fr \
--cc=umair.hvg@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).