From: skaller <skaller@users.sourceforge.net>
To: Nicolas Pouillard <nicolas.pouillard@inria.fr>
Cc: caml-list <caml-list@inria.fr>, "jake.donham" <jake.donham@skydeck.com>
Subject: Re: [Caml-list] ocamlbuild: args to tags?
Date: Tue, 25 Sep 2007 03:38:53 +1000 [thread overview]
Message-ID: <1190655533.6047.27.camel@rosella.wigram> (raw)
In-Reply-To: <1190644392-sup-9865@ausone.inria.fr>
On Mon, 2007-09-24 at 17:23 +0200, Nicolas Pouillard wrote:
> > (* My Ocaml File .. *)
> > (*#Syntax Mycamlp4syn *) (* for compatibility *)
> > #syntax Mycamlp4syn; (* better *)
>
> This sounds like a good idea. That's not a new one and it was our first
> choice when designing ocamlbuild. However after some reflections we decided
> that one can first do _tags method and then provide a way to read tags from
> the file itself.
There's slight difference in view as expressed here.
I wouldn't suggested arbitrary "tags" or hints be first class syntax
(although one might put them in comments).
I'm not against tags annotations.. I'm suggesting the specification
of the syntax extension doesn't belong on the command line,
or in a tags file, it belongs in the file.
> The main problem with the solution with embedded tags is that one must at
> least define a how to read these annotations. This is not that easy since a
> .ml file can be a pre-processed file with a totally different syntax.
No, this should not be allowed: that's my point. Every Ocaml file uses
THE syntax for either *.mli or *.ml, end of story. If it uses some
other language, it should have a different extension.
However the syntax can be extensible, but the extensions must be
at least loaded, if not defined, IN the file.
Felix does this. It uses Dypgen GLR parser and OCS Scheme
to implement it. You have to say:
open syntax felix;
or you can't parse anything except syntax extensions :)
The whole of the language proper (except nonterminals
mapped to terminals such as literals) is specified
by a dynamically specified grammar. In Felix,
you can extend the grammar 'anywhere', the extensions are
properly scoped.
So actually, there's no problem designing a syntax which allows
loading another syntax, that is, a bootstrap syntax. For Ocaml,
you could easily add a directive
open syntax Mysyntax
or
#syntax Mysyntax
to the standard grammar, and make camlp4 parse it and use it
to load syntax extensions. Running camlp4 so this happens should
be the mandatory, no -pp command stuff: camlp4 IS the Ocaml parser.
Then, when you run, say, ocamldoc, it knows which extensions to load,
as does the human reader.
It's just the same as
let (@) f g x = f (g x)
The "syntax extension" of the user defined operator @ for composition
is defined IN the program.
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
prev parent reply other threads:[~2007-09-24 17:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-18 18:01 Jake Donham
2007-09-24 12:29 ` [Caml-list] " Nicolas Pouillard
2007-09-24 14:03 ` skaller
2007-09-24 15:23 ` Nicolas Pouillard
2007-09-24 17:38 ` skaller [this message]
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=1190655533.6047.27.camel@rosella.wigram \
--to=skaller@users.sourceforge.net \
--cc=caml-list@inria.fr \
--cc=jake.donham@skydeck.com \
--cc=nicolas.pouillard@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