From: Jonathan Roewen <jonathan.roewen@gmail.com>
To: Jon Harrop <jon@ffconsultancy.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] ocamllex+ocamlyacc and not parsing properly
Date: Mon, 8 Aug 2005 18:47:20 +1200 [thread overview]
Message-ID: <ad8cfe7e05080723475042f72b@mail.gmail.com> (raw)
In-Reply-To: <200508080739.04662.jon@ffconsultancy.com>
On 8/8/05, Jon Harrop <jon@ffconsultancy.com> wrote:
> On Monday 08 August 2005 06:03, Jonathan Roewen wrote:
> > BTW: A tutorial on these sorts of things (i.e. something a bit more
> > complicated than the calculator example) would be great to have as a
> > resource.
>
> Given that the grammar is tiny and the lexer has almost as much OCaml code as
> lexing rules, I think this is a good candidate for not using lexing and
> parsing at all. If you wrote this as an OCaml function, how long would it be?
I have no idea, and don't really want to think about it either.
Perhaps someone could come up with a fancy regex using the Str module
that could do it in a single line, although you'd still need to
generate the types with some big function.
The lexer and parser are straightforward and simple, and they work
(now -- using a ref). Not to mention clear to read :) I think a giant
regex and type generating function would be less clear and
understandable. Sure it'll prolly add about 10Kb using lexer+parser,
but I don't care too much about that.
Jon
next prev parent reply other threads:[~2005-08-08 6:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-07 21:39 Jonathan Roewen
2005-08-07 21:54 ` Jonathan Roewen
2005-08-07 23:58 ` Jon Harrop
2005-08-08 2:17 ` Jonathan Roewen
2005-08-08 4:23 ` Jonathan Roewen
2005-08-08 5:03 ` Jonathan Roewen
2005-08-08 6:39 ` Jon Harrop
2005-08-08 6:47 ` Jonathan Roewen [this message]
2005-08-08 8:59 ` skaller
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=ad8cfe7e05080723475042f72b@mail.gmail.com \
--to=jonathan.roewen@gmail.com \
--cc=caml-list@yquem.inria.fr \
--cc=jon@ffconsultancy.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