From: Daniil Baturin <daniil@baturin.org>
To: "Jocelyn Sérot" <jocelyn.serot@uca.fr>
Cc: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] Camlp4-free implementation of stream parsers (was camlp4 & OCaml 4.08)
Date: Wed, 24 Jul 2019 22:31:43 +0700 [thread overview]
Message-ID: <e44adb0a-179c-b66f-0dec-c52338cdb5f1@baturin.org> (raw)
In-Reply-To: <8748682C-8208-4FF7-A632-D8E06B80960A@uca.fr>
Hi Jocelyn,
I've completed the first version of my project, so now I can start
looking into this again!
There's a third option: parser combinators like angstrom.
My experience with Menhir is very positive though. After initial
struggle, I came to like its new incremental API and declarative error
reporting.
Here's my parser for an extended BNF:
Menhir grammar:
https://github.com/dmbaturin/bnfgen/blob/master/src/bnf_parser.mly
Parser driver that feeds it tokens:
https://github.com/dmbaturin/bnfgen/blob/master/src/parse_bnf.ml
Error messages:
https://github.com/dmbaturin/bnfgen/blob/master/src/bnf_parser.messages
Error message module build:
https://github.com/dmbaturin/bnfgen/blob/master/src/dune#L6-L8
On 7/24/19 10:10 PM, Jocelyn Sérot wrote:
> Hi Daniil (and everyone interested by the subject),
>
> Did you have a closer look at this ?
>
> I’m still hesitating between these three approaches for replacing the implementation of the small arithm expression parser used in Lascar [1] :
>
> i. rewrite it using the basic fns provided by the Stream library (pro: no additionnal dependency, cons: not so trivial..)
>
> ii. replace camlp4 by camlp5 (pro: straightforward, cons: long term maintainability of camlp5 (?))
>
> iii. rewrite it using ocamlex/menhir and embed it in the main code (pro: « standard » soon; cons: a bit heavy)
>
> Jocelyn
>
> [1] https://github.com/jserot/lascar/blob/master/src/lib/fsm_expr.ml, lines 70–112
>
> Le 2 juil. 2019 à 11:25, Daniil Baturin <daniil@baturin.org> a écrit :
>
>> Hi Jocelyn,
>> Camlp5 is still sort of maintained, but I don't think it's going to be
>> developed beyond compatibility updates.
>> For syntax extensions, everyone is switching to PPX.
>>
>> From a quick look, it seems like the only bit of camlp4 you use is
>> stream expressions.
>> This is one of the things PPX can't do (on purpose, since it doesn't
>> allow _arbitrary_ extensions),
>> but I don't think just using streams directly is going to make code much
>> longer.
>>
>> Or I missed some other camlp4 bits?
>>
>> I'm ready to work on a patch if you are open to it.
>>
>> On 7/2/19 1:44 PM, Jocelyn Sérot wrote:
>>> Le 29 juin 2019 à 17:15, Daniil Baturin <daniil@baturin.org> a écrit :
>>>
>>>> Perhaps we should make some coordinated effort to help them.
>>>> I've just sent a pull request to the ocamldot maintainer that enables
>>>> the graphviz files parsing and printing modules
>>>> to build and work with 4.08. The GTK parts have their own issues.
>>>> Next I'm going to look into LASCAR/RFSM (packages that interest me first ;).
>>>>
>>> Hi Daniil,
>>>
>>> I’ve been been thinking of removing the dependency of Lascar and RFSM on camlp4 for a while.
>>> Is switching to CamlP5 a good alternative ?
>>>
>>> Jocelyn
>>>
>>>
>>
next prev parent reply other threads:[~2019-07-24 15:31 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-27 13:45 [Caml-list] camlp4 & OCaml 4.08 Richard W.M. Jones
2019-06-27 17:28 ` Ian Zimmerman
2019-06-27 20:00 ` Richard W.M. Jones
2019-06-27 18:09 ` Jürgen Hötzel
2019-06-29 9:06 ` Anil Madhavapeddy
2019-06-29 9:43 ` Richard W.M. Jones
[not found] ` <12C0FD24-2DCD-4128-B020-84416F228E87@metastack.com>
2019-06-29 10:52 ` Richard W.M. Jones
2019-06-29 17:49 ` Sylvain Le Gall
2019-07-18 14:23 ` Richard W.M. Jones
2019-07-23 8:12 ` Richard W.M. Jones
2019-07-23 16:33 ` Sylvain Le Gall
2019-07-23 16:37 ` Richard W.M. Jones
2019-06-30 8:55 ` David Allsopp
2019-07-01 13:40 ` Jeremie Dimino
2019-07-02 14:30 ` Louis Gesbert
2019-06-29 15:15 ` Daniil Baturin
[not found] ` <5CE377AD-CB06-4261-BD26-A2A697253F02@uca.fr>
[not found] ` <393603fa-0efa-5714-82da-ba4bc3e869b8@baturin.org>
2019-07-05 9:55 ` [Caml-list] Lascar/RFSM & Camlp4 (was camlp4 & OCaml 4.08) Jocelyn Sérot
2019-07-24 15:10 ` [Caml-list] Camlp4-free implementation of stream parsers " Jocelyn Sérot
2019-07-24 15:31 ` Daniil Baturin [this message]
[not found] <C4399DA5-3383-4A7E-9546-0021083D6EF3@uca.fr>
2019-07-25 10:27 ` Jocelyn Sérot
2019-07-25 11:42 ` Gabriel Scherer
2019-07-25 15:20 ` Jocelyn Sérot
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=e44adb0a-179c-b66f-0dec-c52338cdb5f1@baturin.org \
--to=daniil@baturin.org \
--cc=caml-list@inria.fr \
--cc=jocelyn.serot@uca.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