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 9A7387ED34 for ; Fri, 6 Jul 2012 16:33:42 +0200 (CEST) Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.161.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail1-smtp-roc.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.161.182 as permitted sender) identity=mailfrom; client-ip=209.85.161.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@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-gg0-f182.google.com) identity=helo; client-ip=209.85.161.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-gg0-f182.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsIBABP29k/RVaG2kGdsb2JhbABFFqYckQAIIgEBAQEJCQ0HFAQjghgBAQEEEgIsARsJCQsBAwwGBQsNDSEiAREBBQEKEgYTCAoQh1oBAwsLm3QJA4wjgnGFJQoZJwMKV4hxAQUMiy2GJgOVN4ESjRQ+hAA X-IronPort-AV: E=Sophos;i="4.77,537,1336341600"; d="scan'208";a="165883023" Received: from mail-gg0-f182.google.com ([209.85.161.182]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 06 Jul 2012 16:33:40 +0200 Received: by ggnm2 with SMTP id m2so12687878ggn.27 for ; Fri, 06 Jul 2012 07:33:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=gf3c9r0BkLu7wm9q0zp/5A3TFlN49oT+NG1RJa5GX+U=; b=zk9QCA2HkHqhL1W+JMMS1dIhmVR44+GySpifOZH23KHwq5lpGSCHgYU01mREx1ijjD 4BX+c0UM48/lQfp2gHKVn3Ln4fKEiUULSgnkJKA/uk1ZVCDj5Z1J4AWN42Gm8nKv8hvn TAHp1np6rUweLUDJAYeRrSTdudF1VFSniPDxm5NGbHMcZTlZz/+eavatpTaGqC/WV+uw 1b2wu2v5Oqb2NyquRm+My1F5MGhG+kuK70ZmrTH1/90AV35+iBvapyOz/OZr9ySinHy8 R4SVOz91Jrk8CZdSdGSKaujaCuwL6VCrybmeOEaxT2fVeQlrJwNJSSP5NK/Hd9YOXvDY nblg== Received: by 10.50.202.8 with SMTP id ke8mr2740887igc.6.1341585219553; Fri, 06 Jul 2012 07:33:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.50.94.39 with HTTP; Fri, 6 Jul 2012 07:32:58 -0700 (PDT) In-Reply-To: References: From: Gabriel Scherer Date: Fri, 6 Jul 2012 16:32:58 +0200 Message-ID: To: Andrej Bauer Cc: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] Agda-style parser My advice would be to mimic Agda's conceptual two-pass process: parse only the static Context-Free Language structure of your language, parsing "expressions" (or any syntactic class that admits mixfixes) into just a list of non-terminals (plus parenthesing, if you assume your mixfixes are all well-balanced wrt. symmetric delimitors). This can be done easily with existing OCaml parser or parser generator technology (menhir). Then, in a later pass, you compute mixfix definitions/scopes and add this structure to the parsetree, using a custom algorithm that has been described in the Agda literature (or non-Agda previous work), eg. http://www.cse.chalmers.se/~nad/publications/danielsson-norell-mixfix.html . This is a clean way to handle this and, I believe, one of the simplest to use, understand and debug. On Fri, Jul 6, 2012 at 2:52 PM, Andrej Bauer wrote: > If I wanted a parser in Ocaml that can parse things in teh style of > Agda (with the cool underscore thingy), where would I start looking? > > With kind regards, > > Andrej > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa-roc.inria.fr/wws/info/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >