Version française
Home     About     Download     Resources     Contact us    
Browse thread
Camlp4: example/parse_files.ml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Hendrik Tews <tews@c...>
Subject: Re: [Caml-list] Camlp4: example/parse_files.ml
"Nicolas Pouillard" <nicolas.pouillard@gmail.com> writes:

   I think that's doable (not tested), basically you need three
   primitive functors:

I don't see how. Let me clarify again what I mean. And let me
clarify that I only pursue this discussion out of curiosity, to
see, what can be done with the functorial Camlp4 interface. 

Assume we have a table like this:

    s1.cmo s2.cmo ... : f1.ml f2.ml ...
    s3.cmo s4.cmo ... : f3.ml f4.ml ...

The sx.cmo files are Camlp4 syntax extentions and the fx.ml are
files to be parsed using those syntax extentions. There are a
number of possible solutions:
- starting camlp4 for each file or each row
- clearing PreCast.Syntax before each row and then calling the
  callbacks that the syntax extensions registered

But I would like to know if the functorial Camlp4 design is
strong enough to solve this exercise within one program (without
fork/exec) and without reusing/clearing one syntax module.

It is clear that the registration in Register.SyntaxExtension is
not good enough, because it always applies the syntax extension
to PreCast.Syntax.

However, even with changing Register.SyntaxExtension or how
syntax extensions register themselves, I can't see a solution.

Bye,

Hendrik