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 mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by sympa.inria.fr (Postfix) with ESMTPS id 3D1947ED52 for ; Wed, 25 Jul 2012 13:45:48 +0200 (CEST) Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of bobzhang1988@gmail.com) identity=pra; client-ip=209.85.160.54; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="bobzhang1988@gmail.com"; x-sender="bobzhang1988@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail1-smtp-roc.national.inria.fr: domain of bobzhang1988@gmail.com designates 209.85.160.54 as permitted sender) identity=mailfrom; client-ip=209.85.160.54; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="bobzhang1988@gmail.com"; x-sender="bobzhang1988@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-pb0-f54.google.com) identity=helo; client-ip=209.85.160.54; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="bobzhang1988@gmail.com"; x-sender="postmaster@mail-pb0-f54.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtkBACDcD1DRVaA2imdsb2JhbABFhS20LggiAQEBCgkNBxIGI4I5AhMRCAEbHAIDEhAWFhgDAgECARERAQUBIg0IAQEeh1sBAwsBmWqCYQkDjCOCcYVLChknDVeIcQEFDJI1A5VJgRSNHD6EGg X-IronPort-AV: E=Sophos;i="4.77,652,1336341600"; d="scan'208";a="168092801" Received: from mail-pb0-f54.google.com ([209.85.160.54]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 25 Jul 2012 13:45:47 +0200 Received: by pbbro2 with SMTP id ro2so1612525pbb.27 for ; Wed, 25 Jul 2012 04:45:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=TJhCAzfUOR235gwjfK9YUf+O/fy79UZPpRHe8TN3PLs=; b=lVwnBCGrjOaJAoVulKgC3KiB5btiFUFszZVEC/waZ4g+LHHkfn149jbJMyV00JiOgP yxiFbYPm4HpGFixgJBwJg+qhU6ZRJ5AOD+xbGNPXsQnomrUC3DjvceZdc7Ji5cEEJeRD VNQgWbYDN5IqMtTfL0bqqy6VPIUJtV0axPYO87yL4ZzELWhZEjd800r7zTYaMjTwl2iJ RQx2K6yUhfhha7PqeGECkrxMFYGPY3/5iJ9sH3M5brORrWu3deUqLZ3oedpcnOualrp0 32wtPN2Dd4kEV8Y3eO9ZHvoW1pN8YeTIGLrn1NAOyYqZBdO8mAD3mesPBt4KhK1AlfYs nklg== Received: by 10.68.201.9 with SMTP id jw9mr52733545pbc.28.1343216745583; Wed, 25 Jul 2012 04:45:45 -0700 (PDT) Received: from Hongbos-MacBook-Air.local ([115.152.210.66]) by mx.google.com with ESMTPS id nu5sm14237596pbb.53.2012.07.25.04.45.41 (version=SSLv3 cipher=OTHER); Wed, 25 Jul 2012 04:45:42 -0700 (PDT) Message-ID: <500FDC64.8020301@gmail.com> Date: Wed, 25 Jul 2012 07:45:40 -0400 From: Hongbo Zhang User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Caml List Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Caml-list] Ask for help on compiler's module Typing.types Hi List, I was doing some code generation based on type information. The following code snippet was what I tried in the toplevel: match Env.lookup_value (Longident.Lident "f") !Toploop.toplevel_env with | (_, { Types.val_type = val_type }) -> Printtyp.type_expr std_formatter val_type As we see, we can query "f" , get its type information and pretty print it, and then parse it again to get the type information. Actually, we can process Types.val_type directly in a more robust way, but I found the type definitions in typing/types.ml was quite verbose and without any comment. I understand it generally but not in a precise way. Would anyone shed some light on the internal design of typing directory? English or French are both welcome. Thanks in advance! -Hongbo