Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Paul Guyot <pguyot@kallisys.net>
To: caml-list@inria.fr
Subject: [Caml-list] [PATCH] genlex documentation fix
Date: Fri, 9 Apr 2004 16:02:29 +0200	[thread overview]
Message-ID: <f0521063ebc9c5ccddb31@[132.227.204.75]> (raw)

[-- Attachment #1: Type: text/plain, Size: 1180 bytes --]

Hello,

The sample code in the genlex module documentation is broken.
Attached (and below) is a patch to fix it from the CVS version.

Paul
----
Index: genlex.mli
===================================================================
RCS file: /caml/ocaml/stdlib/genlex.mli,v
retrieving revision 1.8
diff -u -r1.8 genlex.mli
--- genlex.mli  2001/12/07 13:40:51     1.8
+++ genlex.mli  2004/04/09 13:59:13
@@ -29,12 +29,16 @@
     to, for instance, [int], and would have rules such as:

     {[
-           let parse_expr = parser
-                  [< 'Int n >] -> n
-                | [< 'Kwd "("; n = parse_expr; 'Kwd ")" >] -> n
-                | [< n1 = parse_expr; n2 = parse_remainder n1 >] -> n2
-           and parse_remainder n1 = parser
+
+           let rec parse_expr = parser
+                  [< 'Int n>] -> n
+                | [< 'Kwd "(";
+                     n = parse_expr;
+                     n2 = parse_remainder n;
+                     'Kwd ")" >] -> n2
+           and parse_remainder n1 = parser
                    [< 'Kwd "+"; n2 = parse_expr >] -> n1+n2
+                | [< 'Kwd "-"; n2 = parse_expr >] -> n1-n2
                  | ...
     ]}
  *)

[-- Attachment #2.1: %genlex.mli.diff --]
[-- Type: application/applefile, Size: 125 bytes --]

[-- Attachment #2.2: genlex.mli.diff --]
[-- Type: application/octet-stream, Size: 1025 bytes --]

Index: genlex.mli
===================================================================
RCS file: /caml/ocaml/stdlib/genlex.mli,v
retrieving revision 1.8
diff -u -r1.8 genlex.mli
--- genlex.mli	2001/12/07 13:40:51	1.8
+++ genlex.mli	2004/04/09 14:01:42
@@ -29,12 +29,16 @@
    to, for instance, [int], and would have rules such as:
 
    {[
-           let parse_expr = parser
-                  [< 'Int n >] -> n
-                | [< 'Kwd "("; n = parse_expr; 'Kwd ")" >] -> n
-                | [< n1 = parse_expr; n2 = parse_remainder n1 >] -> n2
-           and parse_remainder n1 = parser
+
+           let rec parse_expr = parser
+                  [< 'Int n>] -> n
+                | [< 'Kwd "(";
+                     n = parse_expr;
+                     n2 = parse_remainder n;
+                     'Kwd ")" >] -> n2
+           and parse_remainder n1 = parser
                   [< 'Kwd "+"; n2 = parse_expr >] -> n1+n2
+                | [< 'Kwd "-"; n2 = parse_expr >] -> n1-n2
                 | ...
    ]}
 *)

[-- Attachment #3: Type: text/plain, Size: 151 bytes --]

-- 
Philosophie de baignoire - consultations sur rendez-vous.

NPDS/NewtonOS: http://newton.kallisys.net:8080/
Apache/FreeBSD: http://www.kallisys.com/

                 reply	other threads:[~2004-04-09 14:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='f0521063ebc9c5ccddb31@[132.227.204.75]' \
    --to=pguyot@kallisys.net \
    --cc=caml-list@inria.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