From: Eckart Goehler <goehler@astro.uni-tuebingen.de>
To: caml-list@inria.fr, "Rafael 'Dido' Sevilla" <dido@imperium.ph>
Subject: Re: [Caml-list] parsing forward references in ocamlyacc and other ocamlyacc questions
Date: Fri, 5 Sep 2003 14:07:48 +0200 (CEST) [thread overview]
Message-ID: <Pine.LNX.4.44.0309051359020.26116-100000@aitp01.ait.physik.uni-tuebingen.de> (raw)
In-Reply-To: <20030903053114.GA2490@imperium.ph>
Hi,
On Wed, 3 Sep 2003, Rafael 'Dido' Sevilla wrote:
> I'm just wondering how you can guarantee that certain imperative effects
> occur, like adding a name into a symbol table hash. I'm writing a
> compiler whose semantics allow some limited forward references, e.g.:
...
> until after the entire adt_declaration has been parsed. The
> documentation for ocamlyacc has very little to say about it (unless
> there's more documentation in other places besides the ocaml manual).
As far as I understand ocamlyacc behaves as the original yacc (but not
bison).
> I'll also ask how I would go about processing file inclusion in
> ocamlyacc using ocamllex...
Tricky. Calling the parser function "main" from within the parser does not
work currently with ocamlyacc. I tried this myself and ended in patching
ocamlyacc:
- the main function generated by ocamlyacc has to be recursive (let rec
main = ...).
- the parser table written out has to be defined before the main function.
- because ocamllex needs the token information but must be defined
*before* the parser (otherwise you can't recursively call ocamllex) the
token have to be written into a different file (for foo.mly I choosed
the output file name to be footoken.ml/footoken.mli).
But file inclusion is a bit difficult because you can't always be shure
that the processing order is kept (mentioned by the main problem you have:
imperative features while parsing.
Maybe the patch should be implemented in ocamlyacc
eckart
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
next prev parent reply other threads:[~2003-09-05 12:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-03 5:31 Rafael 'Dido' Sevilla
2003-09-05 12:07 ` Eckart Goehler [this message]
2003-09-05 20:56 ` Michal Moskal
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=Pine.LNX.4.44.0309051359020.26116-100000@aitp01.ait.physik.uni-tuebingen.de \
--to=goehler@astro.uni-tuebingen.de \
--cc=caml-list@inria.fr \
--cc=dido@imperium.ph \
/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