I'm going to define a parser and a printer for a simple grammar.
Is there a way to define both of them in a single construct using some
existing OCaml tool?
For example, I have a keyword function. The usual parser would contain
a mapping like:
function - `Function
and the straightforward
I find it odd that there is no Threaded_Queue module, a thread save
version of Queue with 2 extra functions: (...)
I use such a thread-safe queue a lot [1]. This is very simple yet
universal enough. Honestly I can hardly remember using more elaborate
constructs.
Dawid
[1]
It is not clear that this will work at all.
The semantics of ocaml (contrary to SML) is not defined in terms of
type generativity.
This is great eureka to me.
I thought that when the compiler refuses to unify some types it knows
that they are incompatible (as the error message says).
But
type 'a t = {l: float}
Any thoughts ?
I think the crucial question is when new record types are born. Here is
my opinion:
The = sign in the above type mapping definition is what I would call
delayed binding. Early binding would be equivalent to
type tmp = {lab : float}
type 'a s = tmp
Thinking about the discussion in the recent thread Phantom types [1],
I have created the following piece of code that aims to demonstrate
binding and evaluation order that takes effect in all three levels of OCaml.
My question is: what are the precise rules is the case of type language?
I have
Thinking about the discussion in the recent thread Phantom types [1],
I have created the following piece of code that aims to demonstrate
binding and evaluation order that takes effect in all three levels of OCaml.
My question is: what are the precise rules is the case of type language?
I have
I tried to extend the standard Set module with new operations. I got
error messages about type incompatibilities (the Set.S.t as exposed by
my implementation and Set.S.t used by functions from the original Set).
I have reduced my code to the following small example:
module Set = struct
I've found that I have more fundamental problem. What is the exact
meaning of the following line?
module type Foo = functor (X:X) - sig val foo : X.t end
(1) Foo is not a functor, but it is a type of some functors that map
modules to modules
(2) Foo is a mapping from modules to module types
1. The following piece of code contains illegal constructs. These are
functor applications marked with (* ? *).
Basically, I need module type of what is produced by functor.
My first question is: what is the proper, canonical workaround
for unavailability of applications marked (* ? *)
Christoph Bauer pisze:
Please try:
$ cd asmrun
$ cpp -DSYS_aix power-aix.S power-aix.s
$ as -u power-aix.s
$ cd ..
$ make opt
Christoph Bauer
Apparently I can go directly without preprocessor (and cpp I have on the
AIX machine doesn't like asm syntax):
$ cp power-aix.S power-aix.s
$
unfortunatly I haven't a solution for the bytecode stuff. I only use
ocaml with native compiled code. This works very well.
Native code would also be sufficient (to save me from translating lot of
code to C).
The problem is that the assembler available on AIX doesn't unserstand
I have installed part of this OCaml port
http://home.arcor.de/chr_bauer/ocaml-aix.html
on a computer running on AIX. It seems that everything built correctly
except ocamlopt. So I have ocamlrun and standard library and this should
be enough for bytecode to run.
I have to build the bytecode on
Yes. ocamlopt -pack actually calls ld -r underneath to
consolidate several compilation units in a single .cmx/.o file.
ld -r will resolve references between these compilation units.
I tried with this switch and indeed I can link a toy program by
arbitrary intermediate steps. It works OK and
I have lot of modules and they are compiled to native code.
So I have .cmx and .o files and want to link them faster.
Is is possible to make linking an associative operation acting on modules?
I would like to do something like the following:
Knowing the correct partial order of modules (that
I have lot of modules and they are compiled to native code.
So I have .cmx and .o files and want to link them faster.
Is is possible to make linking an associative operation acting on modules?
I would like to do something like the following:
Knowing the correct partial order of modules (that
I have compiled MinGW port of the comopiler (3.10) with memprof patch
applied.
I can produce heap dumps, but heapstats tool fails to load it.
I had to change major_gc.c, the line:
#include unistd.h
is replaced by a stub:
int getpid() {return 8;}
I had to tag all files in hp dir as precious
I have an OCaml program using GTK running on Windows, using multiple
threads.
The overall memory usage grows significantly over time, but I don't know
why. After it consumes several MB extra, it slows considerably and
becomes unusable, so I have to fix this.
Is it possible that this is
You might want to instrument the [caml_]register_global_root function
and see how often it gets called.
Is it possible to enable profiling in the compiler in Windows or Cygwin
environment? Cygwin has gprof, but OCaml's configure script says 'no
profiling'.
Dawid
This was actually a bug in GNOME Terminal... sorry for the noise.
Dawid
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list:
Weird ... I was going to suggeest it was because you weren't flushing
the output after each print statement.
This raises important question:
Let's see the output as a sequence of bytes (there's no time).
Assuming that the process exits normally and incompatible printing
functions are not
I have a program, which output is produced only with Printf.printf .
This inner part is executed by another one (outer) using Unix.system .
The outer executable uses print_endline before and after the inner is run.
From time to time the output of the inner program is corrupt.
Printf.printf
Few days ago I spent some time googling for any info in the subject and
found nothing (except assigned feature requests in the tracer).
Would be great to know what should be expected about OCaml in a long term.
I understand that there's no manpower to push the core compiler forward
faster. But
I've noticed stange behaviour:
The following works OK (using #directory directive):
#!/usr/bin/ocamlrun ocaml
#directory /home/dt2/Calc1/CalcEngine/src/_build/extlib/
#load enum.cmo
open Enum
But this version not (using the full path directly):
#!/usr/bin/ocamlrun ocaml
#load
Another problem with loading modules in the toplevel:
I need to use the module A. So I write:
#load A.cmo
to get a messsage Reference to undefined global B
So I prepend a line:
#load B.cmo
and get another undefined global. Then it repeats prohibitively many
times.
This is resolving dependencies
The problem is that it gives Unbound module Enum while no error about loading the
cmocmi is shown.
The #directory instruction is needed to find the .cmi.
I see, so there are 2 problems:
* why the failure to load cmi is silent in this case?
* why the toplevel fails to check for cmi where
in case you're doing so this way:
ocamlc -o my.cma mod1.ml mod2.ml mod3.ml mod4.ml
this will recompile everything,
but you can use in your makefile:
(...)
then you don't recompile everything, only the modified module
Yes, with ocamlbuild I need not to recompile everything, but it's slow
Hope this helps,
Exactly what I wanted to know! Thanks!
Dawid
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list:
Thanks for your answer; now I'll try to sate my point in a clear way,
since you misunderstood all my questions.
I put 'a in the interface:
val fu : 'a - 'a
and int in the implementation:
let fu x = x + 1
this interface doesn't reflect the implementation, ocaml will reject it in any
way
OK,
Just an elementary question.
I put 'a in the interface:
val fu : 'a - 'a
and int in the implementation:
let fu x = x + 1
So I have universal quantification: for any type 'a function fu can
consume the argument. So my implementation doesn't comply with that
universal quatification. And the
Thank you all for quick answers!
Let me show an example of what I exactly mean. I start with a code:
1: let a = heavy 1
2: let b = heavy 2
3: let c = report (a + b)
4: let d = heavy 4
5: let e = heavy d
Then I want to translate it automatically so that three applications of
heavy are evaluated
30 matches
Mail list logo