* [Caml-list] Reading Custom Type
@ 2017-06-29 15:24 Umair Siddique
2017-06-29 15:36 ` Evgeny Roubinchtein
0 siblings, 1 reply; 2+ messages in thread
From: Umair Siddique @ 2017-06-29 15:24 UTC (permalink / raw)
To: caml-list
[-- Attachment #1: Type: text/plain, Size: 204 bytes --]
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: 380 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Caml-list] Reading Custom Type
2017-06-29 15:24 [Caml-list] Reading Custom Type Umair Siddique
@ 2017-06-29 15:36 ` Evgeny Roubinchtein
0 siblings, 0 replies; 2+ messages in thread
From: Evgeny Roubinchtein @ 2017-06-29 15:36 UTC (permalink / raw)
To: Umair Siddique; +Cc: OCaml Mailing List
[-- 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 --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-06-29 15:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-29 15:24 [Caml-list] Reading Custom Type Umair Siddique
2017-06-29 15:36 ` Evgeny Roubinchtein
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox