caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: bob zhang <bobzhang1988@gmail.com>
To: Joel Reymont <joelr1@gmail.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Weird behavior of Camlp4 Parser
Date: Thu, 24 Nov 2011 12:31:49 -0500	[thread overview]
Message-ID: <CANcqPu5pCdk=qo8wQ14LFLzx_P1eoWtQaA4QzoEGKeXzmvbK6Q@mail.gmail.com> (raw)
In-Reply-To: <A298682A-DA07-4D9D-9F3D-0641F5D64489@gmail.com>

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

Hi, Joel, camlp4 will do the left factorization automatically.
It's weird because after factorization the order of the rule is changed and
no documentation specify how the rules will be re-organized

2011/11/24 Joel Reymont <joelr1@gmail.com>

> Bob,
>
> On Nov 24, 2011, at 3:22 PM, bob zhang wrote:
>
> > m_expr :
> > [[ "foo"; f -> print_endline "first"
> > | "foo" ; "bar"; "baz" -> print_endline "second"]
> > ];
>
>
> Since camlp4 is a recursive-descent parser, I don't think you can have
> "foo"; ... | "foo"; "bar".
>
> I would suggest having a single "foo" in the rule above and have a
> separate rule that branches depending on whether "bar" is found.
>
> --------------------------------------------------------------------------
> - for hire: mac osx device driver ninja, kernel extensions and usb drivers
> ---------------------+------------+---------------------------------------
> http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
> ---------------------+------------+---------------------------------------
>
>


-- 
Best, bob

[-- Attachment #2: Type: text/html, Size: 1663 bytes --]

      reply	other threads:[~2011-11-24 17:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-24 15:22 bob zhang
2011-11-24 15:47 ` Gabriel Scherer
2011-11-24 16:08   ` bob zhang
2011-11-24 16:33 ` Joel Reymont
2011-11-24 17:31   ` bob zhang [this message]

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='CANcqPu5pCdk=qo8wQ14LFLzx_P1eoWtQaA4QzoEGKeXzmvbK6Q@mail.gmail.com' \
    --to=bobzhang1988@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=joelr1@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).