From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.5 required=5.0 tests=AWL,DNS_FROM_RFC_POST, SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id AF8F4BC37 for ; Wed, 14 Oct 2009 17:27:52 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhYCAFeL1UrRVdiykGdsb2JhbACPU4p5PwEBAQEJCQwHEwOuTTKGUSOIQgEDAwWEKQSBW3SGNQ X-IronPort-AV: E=Sophos;i="4.44,559,1249250400"; d="scan'208";a="38234569" Received: from mail-px0-f178.google.com ([209.85.216.178]) by mail1-smtp-roc.national.inria.fr with ESMTP; 14 Oct 2009 17:27:51 +0200 Received: by pxi8 with SMTP id 8so1190241pxi.27 for ; Wed, 14 Oct 2009 08:27:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=WcuqRgkKeavb6qxHOMenbqhYtnufub4pezttaZS9sQU=; b=SOngd6Stdb5XoYF6njr3qwkZRxVbYdncWklHnpHMVAfGlmKnsuUBmJjeoxcdMp/Ya7 pz7G+YGb3R1AmX+Je2Oma+w/IFexJdCfkMdYzI0mhBwJYhwV3x5YpqUz3gX6Tu6P2Aiw vUvezmg6S8c5nBPuvmvXXJfYJf9JQ6Af6eL0g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=Ws9kF8ruxVlarL30owfVMgLglien7YpLDwHcszX62yPKBYU9TEB42IfCRN3IU2ziuV WgNisRoc2Ja3DimChszZXqxZhMn6+/I+aptaAoXRzA/l7OtKAWeBHirdvaKauw3O4ZKj XXJ4SYIeMNc9GVnEokDY5NQpBUhfF+tq/vXD0= MIME-Version: 1.0 Sender: aaron678@gmail.com Received: by 10.143.21.35 with SMTP id y35mr697381wfi.210.1255534070157; Wed, 14 Oct 2009 08:27:50 -0700 (PDT) Date: Wed, 14 Oct 2009 11:27:50 -0400 X-Google-Sender-Auth: f966700416f41bc0 Message-ID: Subject: camlp5 parsing question From: Aaron Bohannon To: caml-list@yquem.inria.fr Content-Type: text/plain; charset=ISO-8859-1 X-Spam: no; 0.00; camlp:01 ocaml:01 expr:01 expr:01 syntax:01 toplevel:01 camlp:01 grammars:01 parsing:01 upenn:01 int:01 grammar:02 grammar:02 defined:02 parse:02 I don't understand why I am getting certain parse errors after extending a grammar. For instance, if I extend the original OCaml grammar with these rules-- expr: LEVEL "simple" [ [ "`"; "+"; "-" -> <:expr< 1 >> ] | [ "`"; "+"; "*" -> <:expr< 2 >> ] ]; --then when I try out the syntax, I get: # ` + - ;; - : int = 1 # ` + * ;; Toplevel input: # ` + * ;; ^^^ Parse error: '+' '-' expected after '`' (in [expr]) If the grammar is being left-factored according to the description in the documentation (sec. 3.4 of http://pauillac.inria.fr/~ddr/camlp5/doc/htmlc/grammars.html), I don't see why these two rules should get in each other's way. Moreover, the base grammar defined in "pa_o.ml" seems to use rules with similarly overlapping initial parts without any trouble. - Aaron