caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] ANN: Brand-new BER MetaOCaml for OCaml 4.00.1
@ 2013-02-19  3:37 bob zhang
  2013-02-20  1:51 ` Jacques Carette
  2013-02-20 12:20 ` [Caml-list] " oleg
  0 siblings, 2 replies; 5+ messages in thread
From: bob zhang @ 2013-02-19  3:37 UTC (permalink / raw)
  To: oleg; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 1333 bytes --]

Dear Oleg,
   After reading the patch of BER MetaOCaml today, I found that it is not
too hard to port camlp4/Fan to support metaocaml.
   I tried to compile and install metaocaml with the patches you provided:

   I get an install error
./build/partial-install.sh: line 25: config/config.sh: No such file or
directory
make: *** [install] Error 1

   After I ignore the error message, the metaocaml toplevel works perfectly
well.

   But if I customized my own toplevel (I used my toplevel as 'ocamlmktop
-custom -o mocaml')
   mocaml is bundled with compiler-libs, the toplevel does not work, I get
the following
   error message:

   # let spower7 = .! spower7_code;;
   Error: Reference to undefined global `Runcode'

  Currently metaocaml does not support native code, but it seems that the
patch only installs ocamlc, is it possible to get ocamlc.opt installed as
well? (not the ocamlopt.opt) ocamlbuild is not installed either. It would
be even nicer that ocamlopt.opt could be installed without supporting
metaocaml, otherwise I have to switch between different compilers from time
to time.

   Would you mind get the ocamlbuild, ocamlc.opt also works? I would be
happy to port Fan/Camlp4 to support metaoaml, and it would be really cool
to get compile-time and run-time metaprogramming work together

   Thank you in advance!

[-- Attachment #2: Type: text/html, Size: 1604 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] ANN: Brand-new BER MetaOCaml for OCaml 4.00.1
  2013-02-19  3:37 [Caml-list] ANN: Brand-new BER MetaOCaml for OCaml 4.00.1 bob zhang
@ 2013-02-20  1:51 ` Jacques Carette
  2013-02-20 14:03   ` bob zhang
  2013-02-20 12:20 ` [Caml-list] " oleg
  1 sibling, 1 reply; 5+ messages in thread
From: Jacques Carette @ 2013-02-20  1:51 UTC (permalink / raw)
  To: bob zhang; +Cc: oleg, caml-list

You need to use 'metaocamlmktop' to make a custom top-level which 
supports metaocaml.  I have tested this, and it works.

I will let Oleg answer the other queries.

Jacques

On 13-02-18 10:37 PM, bob zhang wrote:
> Dear Oleg,
>    After reading the patch of BER MetaOCaml today, I found that it is 
> not too hard to port camlp4/Fan to support metaocaml.
>    I tried to compile and install metaocaml with the patches you provided:
>
>    I get an install error
> ./build/partial-install.sh: line 25: config/config.sh: No such file or 
> directory
> make: *** [install] Error 1
>
>    After I ignore the error message, the metaocaml toplevel works 
> perfectly well.
>
>    But if I customized my own toplevel (I used my toplevel as 
> 'ocamlmktop -custom -o mocaml')
>    mocaml is bundled with compiler-libs, the toplevel does not work, I 
> get the following
>    error message:
>    # let spower7 = .! spower7_code;;
>    Error: Reference to undefined global `Runcode'
>
>   Currently metaocaml does not support native code, but it seems that 
> the patch only installs ocamlc, is it possible to get ocamlc.opt 
> installed as well? (not the ocamlopt.opt) ocamlbuild is not installed 
> either. It would be even nicer that ocamlopt.opt could be installed 
> without supporting metaocaml, otherwise I have to switch between 
> different compilers from time to time.
>
>    Would you mind get the ocamlbuild, ocamlc.opt also works? I would 
> be happy to port Fan/Camlp4 to support metaoaml, and it would be 
> really cool to get compile-time and run-time metaprogramming work together
>
>    Thank you in advance!


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Caml-list] Re: ANN: Brand-new BER MetaOCaml for OCaml 4.00.1
  2013-02-19  3:37 [Caml-list] ANN: Brand-new BER MetaOCaml for OCaml 4.00.1 bob zhang
  2013-02-20  1:51 ` Jacques Carette
@ 2013-02-20 12:20 ` oleg
  2013-02-20 14:11   ` bob zhang
  1 sibling, 1 reply; 5+ messages in thread
From: oleg @ 2013-02-20 12:20 UTC (permalink / raw)
  To: bobzhang1988; +Cc: caml-list


Bob Zhang wrote:
> After reading the patch of BER MetaOCaml today, I found that it is not
> too hard to port camlp4/Fan to support metaocaml.

That's a good news! Old camlp4 was once ported to MetaOCaml, but it
took really a lot of effort. 

> I get an install error
> ./build/partial-install.sh: line 25: config/config.sh: No such file or directory
> make: *** [install] Error 1

> After I ignore the error message, the metaocaml toplevel works
> perfectly well.

The error comes about because the Makefile doesn't build
ocamlbuild. To save time during the development metaocaml, I skip
building ocamlbuild (I don't use it myself). I guess I didn't
reactivated it. I will fix this shortly in the metaocaml.bundle.
In the meanwhile, you can do 
        make ocamlbuild.byte
in the main ocaml-4.00.1 tree, followed by make install. This time
there should be no build/partial-install.sh error. ocamlbuild will be
installed. 

>    But if I customized my own toplevel (I used my toplevel as 'ocamlmktop
> -custom -o mocaml')
>    mocaml is bundled with compiler-libs, the toplevel does not work, I get
> the following
>    error message:
>
>    # let spower7 = .! spower7_code;;
>    Error: Reference to undefined global `Runcode'

As Jacques said, you do need to use metaocamlmktop. This is just a
shell script; you can look inside and see what libraries and object
files it uses and link your own toplevel accordingly (the order
libraries and object files matters!)

>   Currently metaocaml does not support native code, but it seems that the
> patch only installs ocamlc, is it possible to get ocamlc.opt installed as
> well? (not the ocamlopt.opt) ocamlbuild is not installed either. It would
> be even nicer that ocamlopt.opt could be installed without supporting
> metaocaml, otherwise I have to switch between different compilers from time
> to time.

Yes, it is possible. It is possible almost immediately but I just had
an idea how to do it much better. If works out it will bring essentially
native metaocaml. I will need time to check it though... Well, better
is the enemy of the good. 

If you want ocamlopt urgently (without
using brackets and escapes) I can make a patch easily -- or tell you one
line to add to one file. Namely, to the file 
asmcomp/cmmgen.ml add at the line 1713 (at the end of the function
emit_constant_field) the following single line:
  | Const_csp_value _  -> assert false

After that, do make ocamlopt followed by make install. You get
ocamlopt that, as a side benefit, understands the let! monadic
notation (which never made it to the official version, but seems quite
handy).



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] ANN: Brand-new BER MetaOCaml for OCaml 4.00.1
  2013-02-20  1:51 ` Jacques Carette
@ 2013-02-20 14:03   ` bob zhang
  0 siblings, 0 replies; 5+ messages in thread
From: bob zhang @ 2013-02-20 14:03 UTC (permalink / raw)
  To: Jacques Carette; +Cc: oleg, caml-list

[-- Attachment #1: Type: text/plain, Size: 1811 bytes --]

Hi Jacques,
  metaocamlmktop works well, thanks!

On Tue, Feb 19, 2013 at 8:51 PM, Jacques Carette <carette@mcmaster.ca>wrote:

> You need to use 'metaocamlmktop' to make a custom top-level which supports
> metaocaml.  I have tested this, and it works.
>
> I will let Oleg answer the other queries.
>
> Jacques
>
>
> On 13-02-18 10:37 PM, bob zhang wrote:
>
>> Dear Oleg,
>>    After reading the patch of BER MetaOCaml today, I found that it is not
>> too hard to port camlp4/Fan to support metaocaml.
>>    I tried to compile and install metaocaml with the patches you provided:
>>
>>    I get an install error
>> ./build/partial-install.sh: line 25: config/config.sh: No such file or
>> directory
>> make: *** [install] Error 1
>>
>>    After I ignore the error message, the metaocaml toplevel works
>> perfectly well.
>>
>>    But if I customized my own toplevel (I used my toplevel as 'ocamlmktop
>> -custom -o mocaml')
>>    mocaml is bundled with compiler-libs, the toplevel does not work, I
>> get the following
>>    error message:
>>    # let spower7 = .! spower7_code;;
>>    Error: Reference to undefined global `Runcode'
>>
>>   Currently metaocaml does not support native code, but it seems that the
>> patch only installs ocamlc, is it possible to get ocamlc.opt installed as
>> well? (not the ocamlopt.opt) ocamlbuild is not installed either. It would
>> be even nicer that ocamlopt.opt could be installed without supporting
>> metaocaml, otherwise I have to switch between different compilers from time
>> to time.
>>
>>    Would you mind get the ocamlbuild, ocamlc.opt also works? I would be
>> happy to port Fan/Camlp4 to support metaoaml, and it would be really cool
>> to get compile-time and run-time metaprogramming work together
>>
>>    Thank you in advance!
>>
>
>


-- 
Regards
-- Bob

[-- Attachment #2: Type: text/html, Size: 2390 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Caml-list] Re: ANN: Brand-new BER MetaOCaml for OCaml 4.00.1
  2013-02-20 12:20 ` [Caml-list] " oleg
@ 2013-02-20 14:11   ` bob zhang
  0 siblings, 0 replies; 5+ messages in thread
From: bob zhang @ 2013-02-20 14:11 UTC (permalink / raw)
  To: oleg; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 1747 bytes --]

On Wed, Feb 20, 2013 at 7:20 AM, <oleg@okmij.org> wrote:

>
>
> >   Currently metaocaml does not support native code, but it seems that the
> > patch only installs ocamlc, is it possible to get ocamlc.opt installed as
> > well? (not the ocamlopt.opt) ocamlbuild is not installed either. It would
> > be even nicer that ocamlopt.opt could be installed without supporting
> > metaocaml, otherwise I have to switch between different compilers from
> time
> > to time.
>
> Yes, it is possible. It is possible almost immediately but I just had
> an idea how to do it much better. If works out it will bring essentially
> native metaocaml. I will need time to check it though... Well, better
> is the enemy of the good.
>
> If you want ocamlopt urgently (without
> using brackets and escapes) I can make a patch easily -- or tell you one
> line to add to one file. Namely, to the file
> asmcomp/cmmgen.ml add at the line 1713 (at the end of the function
> emit_constant_field) the following single line:
>   | Const_csp_value _  -> assert false
>
> Yes, I understand it saves  a lot of time to not building something
necessary when do the compiler-hacking, but it would be nice for the user
who try the patch to  see minimum surprise. Would you mind release a new
patch which contains everything except that ocamlc, ocaml byte runtime is
patched? That would be really helpful for other people to give a try as
well.

> After that, do make ocamlopt followed by make install. You get
> ocamlopt that, as a side benefit, understands the let! monadic
> notation (which never made it to the official version, but seems quite
> handy).
>
> Monadic notation is fine, since Camlp4/Fan interacts with metaocaml only
in the Ast level

Thanks


-- 
Regards
-- Bob

[-- Attachment #2: Type: text/html, Size: 2372 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-02-20 14:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-19  3:37 [Caml-list] ANN: Brand-new BER MetaOCaml for OCaml 4.00.1 bob zhang
2013-02-20  1:51 ` Jacques Carette
2013-02-20 14:03   ` bob zhang
2013-02-20 12:20 ` [Caml-list] " oleg
2013-02-20 14:11   ` bob zhang

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).