caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <xavier@Theory.Stanford.EDU>
To: dicosmo@dmi.ens.fr
Cc: caml-list@margaux
Subject: Re: internals of the compiler
Date: Tue, 18 May 1993 17:56:37 -0700 (PDT)	[thread overview]
Message-ID: <9305190056.AA18005@Tamuz.Stanford.EDU> (raw)
In-Reply-To: <9305071502.AA01496@violette.ens.fr> from "dicosmo@dmi.ens.fr" at May 7, 93 05:02:51 pm

>> Je veux ecrire une fonction qui, par exemple, fait un recurrence sur
>> tous les nom exporte's d'un module.
>> --chet--

> C,a m'interesse aussi... je voudrais porter l'util de recherche en librairie
> de CAML en CamlLight, et j'ai besoin de reperer les identificateurs
> avec leur type (donc il faut aussi le type des types et des utils
> pour les manipuler)
> --Roberto

Bon, voila la technique: un .zi, c'est juste une valeur du type
modules__module ("modules", c'est un des fichiers de src/compiler dans
la distribution) ecrite avec output_value. Il suffit donc de faire un
truc comme

#open "modules";;
let interface =
  let ic = open_in_bin "foo.zi" in
  let m = (input_value ic : module) in
  close_in ic;
  m;;

Ensuite, pour decrypter les informations contenues dans la valeur lue,
il faut utiliser les types definis dans les modules const et globals.
Les commentaires dans globals.ml expliquent a peu pres ce qui se
passe. La representation des types est documentee la-dedans aussi. Les
fonctions de manipulation sur les types sont dans le module types.ml.
En resume: il faut au moins faire #open "const";; #open"globals";;
#open "modules";; et compiler avec une option -I.....src/compiler. Si
en plus on veut utiliser les fonctions de types.ml, il faut linker
avec types.zo et sans doute quelques autres .zo du compilateur, a
determiner experimentalement.

Enfin, pour Roberto: ton outil de recherche dans les bibliotheques
ferait un excellent "contrib" !

- Xavier




  reply	other threads:[~1993-05-24  7:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-05-07 15:02 dicosmo
1993-05-19  0:56 ` Xavier Leroy [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-05-07 13:38 murthy

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=9305190056.AA18005@Tamuz.Stanford.EDU \
    --to=xavier@theory.stanford.edu \
    --cc=caml-list@margaux \
    --cc=dicosmo@dmi.ens.fr \
    /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).