caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: Erik de Castro Lopo <ocaml-erikd@mega-nerd.com>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] yacc style
Date: 28 Jan 2005 12:14:39 +1100	[thread overview]
Message-ID: <1106874879.12114.145.camel@pelican.wigram> (raw)
In-Reply-To: <20050128083956.7dc72787.ocaml-erikd@mega-nerd.com>

On Fri, 2005-01-28 at 08:39, Erik de Castro Lopo wrote:
> On Thu, 27 Jan 2005 15:17:13 -0500
> Chris King <colanderman@gmail.com> wrote:
> 
> > Is it considered better style to
> > instead have the parser return a parse tree, and then use that to
> > generate the imperative structure, 
> 
> Yes, normally the parser generates a parse tree which is then
> passed to the semantic analyser for semantic checking.

Unfortunately this is useless in the common case
of needing to parse C. It would surely be nice
to be able to pass an argument to ocamlyacc,
as can now be done for ocamllex.

Strangely in this case the ideal place to add
on  the typedef table would be the lexbuf,
which *is* passed to the parser .. but the client
can't get at it, and it isn't extensible.

The reason this isn't done right seems to be that
yacc/lex are used to bootstrap Ocaml and so fixing
them would destablise the bootstrap.

FYI: in Felix, the parser and lexer are built-in
to the language, and lexical scoping is supported:
whilst you cannot pass in an extra argument to the parser,
you *can* write action code that depends on its
environment, which need not be the top level.

-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net




  reply	other threads:[~2005-01-28  1:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-27 20:17 Chris King
2005-01-27 21:39 ` [Caml-list] " Erik de Castro Lopo
2005-01-28  1:14   ` skaller [this message]
2005-01-28  2:28     ` Erik de Castro Lopo
2005-01-28  4:30       ` skaller
2005-01-28  9:04       ` Jean-Christophe Filliatre
     [not found] ` <200501272252.43720.jon@jdh30.plus.com>
2005-01-28  0:41   ` Chris King

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=1106874879.12114.145.camel@pelican.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=caml-list@inria.fr \
    --cc=ocaml-erikd@mega-nerd.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).