From: John Goerzen <jgoerzen@complete.org>
To: caml-list@inria.fr
Subject: [Caml-list] camlp4 extensions and lexer replacements
Date: Mon, 10 May 2004 14:19:43 -0500 [thread overview]
Message-ID: <20040510191943.GB14068@excelhustler.com> (raw)
Hello,
I am working on developing a syntax extension that:
1. Can use most of the rules in pa_o/pa_r, replaces some, and adds some
2. Requires a new lexer.
Now, it's easy enough to just accomplish #1 with the EXTEND syntax. I
can just place my .cmo after pa_o.cmo on the camlp4 command line and
that's good.
But #2 is trickier. pa_o.ml contains this:
Grammar.Unsafe.gram_reinit gram (Plexer.gmake ());
So I can't define my lexer first -- pa_o.ml will just overwrite it.
Worse, I can't define my lexer second, either. Plexer relies on the
(strange, imho) notion of deciding whether something is a LIDENT or
keyword based on the list of keywords-as-tokens that were encountered in
a grammar. But the grammar reinit functions that I would have to use to
put in my lexer don't preserve that information, so my lexer would have
no way to differentiate a LIDENT from a keyword. Also, Plexer provides
no way to get a list of entries in its internal hashtable.
It seems that there should be an easy way to do this, but I just can't
figure it out.
I would really avoid having to hack up pa_o.ml.
Thanks,
John
-------------------
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 reply other threads:[~2004-05-10 19:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-10 19:19 John Goerzen [this message]
2004-05-11 8:32 ` Virgile Prevosto
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=20040510191943.GB14068@excelhustler.com \
--to=jgoerzen@complete.org \
--cc=caml-list@inria.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