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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id B3E087FA5E for ; Mon, 24 Apr 2017 22:18:22 +0200 (CEST) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=murthy.chet@gmail.com; spf=Pass smtp.mailfrom=murthy.chet@gmail.com; spf=None smtp.helo=postmaster@mail-it0-f51.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of murthy.chet@gmail.com) identity=pra; client-ip=209.85.214.51; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="murthy.chet@gmail.com"; x-sender="murthy.chet@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of murthy.chet@gmail.com designates 209.85.214.51 as permitted sender) identity=mailfrom; client-ip=209.85.214.51; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="murthy.chet@gmail.com"; x-sender="murthy.chet@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-it0-f51.google.com) identity=helo; client-ip=209.85.214.51; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="murthy.chet@gmail.com"; x-sender="postmaster@mail-it0-f51.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AatA71hFsfgSRrk97pQhohJ1GYnF86YWxBRYc798d?= =?us-ascii?q?s5kLTJ78pMywAkXT6L1XgUPTWs2DsrQf2raQ6/iocFdDyK7JiGoFfp1IWk1Nou?= =?us-ascii?q?QttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBAj0OxZr?= =?us-ascii?q?KeTpAI7SiNm82/yv95HJbQhFgDWwbaluIBmqsA7cqtQYjYx+J6gr1xDHuGFIe+?= =?us-ascii?q?NYxWNpIVKcgRPx7dqu8ZBg7ipdpesv+9ZPXqvmcas4S6dYDCk9PGAu+MLrrxjD?= =?us-ascii?q?QhCR6XYaT24bjwBHAwnB7BH9Q5fxri73vfdz1SWGIcH7S60/VDK/5KlpVRDokj?= =?us-ascii?q?8KOT4n/m/KhMJ+j6xUrx2uqRNj2IPUfJybOeBicq/BfN4WW2xMVdtRWSxbBYO8?= =?us-ascii?q?apMCAvQBPelGs4n2ulwArQakBQmwBOPuyiJDi3jz3a0nyeQhDQHG3Qw6E90SsH?= =?us-ascii?q?Tbssn1ObwdUeCw1qbIzDHDY+lK1jf67YjFaxYsquyPU7Joacfd11UjGgffgliT?= =?us-ascii?q?qYHpJS2Z2vkCvmSB7+dsSPqjh3MmpgxwuDSj28Qhh4bTio4Iy13J9z91zJsrKd?= =?us-ascii?q?GmTkNwfMSqH4FKty6AMot7WsMiTH9suCY90rAGvIS0fCkOyJg+xh7fd+CLf5GG?= =?us-ascii?q?4h/jSeqdOzh4hHVieLKwgxa971KsxfH7VsmxyFpKryxFncfQtn0VyRDf9syKRu?= =?us-ascii?q?F+80qhwzqDyR3f5+5eLU00iKbXM5shzaQxlpoXv0TDBCj2mEDuga+Ta0Uk4PSo?= =?us-ascii?q?6+TnY7n8upCcN5F7ih3lP6Qhn8ywG+U4MgwUU2eH/uS80aXv/VflT7VSkv02jq?= =?us-ascii?q?7ZvYjGKssBo665BxZZ0oIi6xakEzery88YnHkCLFJdYh2LlYnpO1fUIPD5F/iz?= =?us-ascii?q?mVqskC04j8zBa7boB5GIKnnYjJ/ge6x84ghS0lkd19dasrlUB61JBe/pRk/g/I?= =?us-ascii?q?jdEwUlMx3yyObqFP1y04ofXSSEBarPY/CaikOB+u96e7rEX4QSojuoc/U=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0A1CQAwXf5YhjPWVdFdHgYMGQYMhRaFR?= =?us-ascii?q?okpmgiDXIsJDoYWhBZDFAEBAQEBAQEBAQEBEgEBAQgLCwgoL4IzIIMDBgEbHQE?= =?us-ascii?q?DEiYVHwETEQEFAYo4AQMVnmg/jgkFARyDCQWDWAoZJw1WgwkBAQgCHgIGCQEIh?= =?us-ascii?q?DGMKYUZBZEOjDOKSIkniXyGcpJRM4EVNoEnJh0ghTMfgg9ViTYBAQE?= X-IPAS-Result: =?us-ascii?q?A0A1CQAwXf5YhjPWVdFdHgYMGQYMhRaFRokpmgiDXIsJDoY?= =?us-ascii?q?WhBZDFAEBAQEBAQEBAQEBEgEBAQgLCwgoL4IzIIMDBgEbHQEDEiYVHwETEQEFA?= =?us-ascii?q?Yo4AQMVnmg/jgkFARyDCQWDWAoZJw1WgwkBAQgCHgIGCQEIhDGMKYUZBZEOjDO?= =?us-ascii?q?KSIkniXyGcpJRM4EVNoEnJh0ghTMfgg9ViTYBAQE?= X-IronPort-AV: E=Sophos;i="5.37,246,1488841200"; d="scan'208";a="270298644" Received: from mail-it0-f51.google.com ([209.85.214.51]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 24 Apr 2017 22:18:07 +0200 Received: by mail-it0-f51.google.com with SMTP id 70so5892769ita.0 for ; Mon, 24 Apr 2017 13:18:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:user-agent:mime-version :content-transfer-encoding; bh=IdVWq2Fpr5WGU+w9GDpe7cwT1z/5tGa/qH4oezJwasI=; b=XkA48jnfKouvZwhm6KrHKZe7JDM/TlRI+ZJsXk/r7n/ammRvdyi2fLXArTp3+8Boke xOAY5WklcmL42BFjq0oaROwWb+r5Z75fgk6CsSJzDBy4PDU4e7NJer90ECNKLhsVKkv5 L8fgBQ5v3VBADK6vxU350hxZq5gA9V3LnmMbrR5/sRJeUhO7pW41cPxO5lqKOsNht4Rz B2TA55nT5UER1IpwTexXxFuK9OU7uLPO0i/83Mbr1+peJKpwfFB/RLvhAUOE5apLW6So xYsqHRsKTHLIXdwG4pzVvl28PipXmddWNcuxZwxoN2bdPIUeOv4LRJjJLMQg+HGNkuXu 29xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:user-agent :mime-version:content-transfer-encoding; bh=IdVWq2Fpr5WGU+w9GDpe7cwT1z/5tGa/qH4oezJwasI=; b=DXJo+DZOoBZLA6cXtojKucRO3wh8tBW6cWg8o3YJu4YhF0NIniIwtsSHTRz66cH+39 As51jX4ZTDGuAE/j5DNd8car/GAv3p8JTlvuPzRktjx0k86kW+HFLzbI+uTKvkCHf5o8 LdXAgqNGiuLWEHLqLrIe1x99c7V0Rf0ApdUGBL7+1u6Dtz154+ppmaqnhAmRTzA9rP19 FHktEMOiQSHNAAmSzM+AdsBgHfI3JgXL9Z9BvMcE4Glr63Pm9rgWec27glyT2zeafH97 yeA8lLFOT303u3L61fFYOxI1buhVLcaLP7xC2c8/Uvg7uwCTkFuT9RZqdNYZSHZfmMfG JgUg== X-Gm-Message-State: AN3rC/6rxvU8iKVq9pI5FPcWr31+z60NWUmoB3y2Oair8vK82iZRiLH4 6pG8UF5btab/mNVu X-Received: by 10.36.211.207 with SMTP id n198mr11931254itg.105.1493065086323; Mon, 24 Apr 2017 13:18:06 -0700 (PDT) Received: from twitter.localnet (mobile-166-184-167-122.mycingular.net. [166.184.167.122]) by smtp.gmail.com with ESMTPSA id y23sm592630ita.9.2017.04.24.13.18.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Apr 2017 13:18:05 -0700 (PDT) From: Chet Murthy To: caml-list@inria.fr Cc: chetsky@gmail.com Date: Mon, 24 Apr 2017 13:18:04 -0700 Message-ID: <2183504.2kfSNf9Hln@twitter> User-Agent: KMail/5.1.3 (Linux/4.4.0-72-generic; KDE/5.18.0; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: [Caml-list] char/line-numbers in error-messages from data-structures bulit via ocamllex? Ages (decades) ago, I recall (perhaps incorrectly) that there was a somewhat well-known way of using ocamllex and {ocamlyacc, PP streams} together, in order to decorate a parse-tree with line-number information -- so that later (e.g. type-checking) passes could emit that line-number information as part of error-messages. As I rack my brain trying to imagine what that method might be, several approaches come to mind: (1) with PP streams, I could define the token-type to be a tuple of the real token-type and a lexing position, e.g. type token = real_token * Lexing.position (2) with camlyacc, I'd have to stuff the position into every branch of the algebraic datatype, e.g. type token = | LIT of Lexing.position * literal | ID of Lexing.position * identifier | OP of Lexing.position * operator ... Both of these seem workable, but I don't remember either of them as being "the" way to do it, back in the day. Does anybody have any memory of this "Echte" way of doing it? Thanks, --chet--