caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Matthieu Wipliez <mwipliez@yahoo.fr>
To: Joel Reymont <joelr1@gmail.com>
Cc: O'Caml Mailing List <caml-list@yquem.inria.fr>
Subject: Re : Re : [Caml-list] Re: camlp4 stream parser syntax
Date: Sun, 8 Mar 2009 01:08:05 +0000 (GMT)	[thread overview]
Message-ID: <154139.25342.qm@web27007.mail.ukl.yahoo.com> (raw)
In-Reply-To: <0B508092-FD71-4733-BC95-B6B87A6D3E6B@gmail.com>


> Matthieu,
> 
> Is the camlp4 grammar parser case-insensitive?
> 
> Will both Delay and delay be accepted in the actionDelay rule?
> 
>     actionDelay: [ [ "delay"; expression ->
>         Asthelper.failwith (convert_loc _loc)
>             "RVC-CAL does not permit the use of delay." ] ];

No, only "delay" is accepted.

> Also, I noticed that your lexer has a really small token set, i.e.
> 
> type token =
>     | KEYWORD of string
>     | SYMBOL  of string
>     | IDENT   of string
>     | INT     of int * string
>     | FLOAT   of float * string
>     | CHAR    of char * string
>     | STRING  of string * string
>     | EOI
> 
> My custom lexer, on the other hand, has a HUGE token set, e.g.
> 
>   type token =
>     | BUY_TO_COVER
>     | SELL_SHORT
>     | AT_ENTRY
>     | RANGE
>     | YELLOW
>     | WHITE
>     | WHILE
>     | UNTIL
>     ...
> 
> This is partly because I have a very large set of keywords.
> 
> Do I correctly understand that I do not need all the keywords since I can match 
> them in the camlp4 grammar as strings like "BuyToCover", "SellShort", etc.?

Yes that's right.

Also a good source of information, being given the status of Camlp4
documentation, is Camlp4 source code, especially camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml and
Camlp4OCamlParser.ml

> I had no idea Camlp4 had been used to write such non-trivial parsers...

Actually the aforementioned files show the power of Camlp4 parsing and grammar extension capabilities quite well IMHO.

Cheers,
Matthieu





  reply	other threads:[~2009-03-08  1:08 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-07 22:38 Joel Reymont
2009-03-07 22:52 ` Joel Reymont
2009-03-07 23:21   ` Re : [Caml-list] " Matthieu Wipliez
2009-03-07 23:42     ` Joel Reymont
2009-03-08  0:40     ` Joel Reymont
2009-03-08  1:08       ` Matthieu Wipliez [this message]
2009-03-08  8:25         ` Re : " Joel Reymont
2009-03-08  9:37           ` Daniel de Rauglaudre
2009-03-08  9:51             ` Joel Reymont
2009-03-08 10:27               ` Daniel de Rauglaudre
2009-03-08 10:35                 ` Joel Reymont
2009-03-08 11:07                   ` Joel Reymont
2009-03-08 11:28                     ` Daniel de Rauglaudre
2009-03-08 11:45           ` Re : Re : " Matthieu Wipliez
2009-03-08 11:52             ` Joel Reymont
2009-03-08 13:33               ` Re : " Matthieu Wipliez
2009-03-08 13:59                 ` Joel Reymont
2009-03-08 14:09                   ` Re : " Matthieu Wipliez
2009-03-08 14:30                     ` Joel Reymont
2009-03-08 15:07                       ` Re : " Matthieu Wipliez
2009-03-08 15:24                         ` Joel Reymont
2009-03-08 15:32                           ` Re : " Matthieu Wipliez
2009-03-08 15:39                             ` Joel Reymont
2009-03-08 15:46                             ` Joel Reymont
2009-03-08 15:55                               ` Re : " Matthieu Wipliez
2009-03-08 16:58                                 ` Joel Reymont
2009-03-08 17:04                                   ` Re : " Matthieu Wipliez
2009-03-08 17:15                                     ` Joel Reymont
2009-03-08  9:34         ` Joel Reymont
2009-03-07 23:52 ` [Caml-list] " Jon Harrop
2009-03-07 23:53   ` Joel Reymont
2009-03-08  0:12     ` Jon Harrop
2009-03-08  0:20       ` Re : " Matthieu Wipliez
2009-03-08  0:29         ` Jon Harrop
2009-03-08  0:30         ` Re : " Joel Reymont
2009-03-08  0:37           ` Re : " Matthieu Wipliez

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=154139.25342.qm@web27007.mail.ukl.yahoo.com \
    --to=mwipliez@yahoo.fr \
    --cc=caml-list@yquem.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).