[Caml-list] wrapping c++

2010-12-20 Thread Joel Reymont
Are there any recipes for wrapping a large C++ class that uses callbacks?

I would like to implement the callbacks in OCaml for obvious reasons.

Thanks, Joel

---
http://twitter.com/wagerlabs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] appending data to a mmap-ed file

2010-12-17 Thread Joel Reymont
I'm fine with focusing on 64-bit architectures. 

Sent from my iPhone

On 17/12/2010, at 14:48, "Richard W.M. Jones"  wrote:

> On Fri, Dec 17, 2010 at 01:36:35AM +0100, Goswin von Brederlow wrote:
>> Or avoid the whole issue and make the file large enough to begin
>> with. Thanks to sparse files you can create a huge file that only uses 1
>> block on disk. Then you can mmap that and it will use up more disk space
>> as you fill in data automatically.
> 
> Sure, if you have an upper limit.  Neither works well on 32 bit
> architectures where you're really limited for contiguous free address
> space.
> 
> Rich.
> 
> -- 
> Richard Jones
> Red Hat
> 
> ___
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] appending data to a mmap-ed file

2010-12-16 Thread Joel Reymont
Jesper,

On Dec 16, 2010, at 12:38 PM, Jesper Louis Andersen wrote:

> Simply have an Ocaml array of bytes or something such to
> store data into (my Ocaml representation specific knowledge is not up
> to par at the moment, but arrange it such that the byte-array has
> C-representation underneath.

The data comes from a C++ thread running a market data feed. I was planning to 
manage the memory-mapped file in the same thread and only notify OCaml when new 
data is available, after extending the memory mapping. It seems to be the 
simplest approach to me. 

I also need to launch a C++ thread from OCaml and talk to it but that's 
probably a subject for a new mailing list thread. 

Thanks, Joel

---
http://twitter.com/wagerlabs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] appending data to a mmap-ed file

2010-12-16 Thread Joel Reymont
I'm constantly appending to a file of stock quotes (ints, longs, doubles, 
etc.). I have this file mapped into memory with mmap. 

What's the most efficient way to make newly appended data available as part of 
the memory mapping?

Obligatory OCaml content: I'm trying to prototype a trading system in OCaml.
 
Thanks, Joel

---
http://twitter.com/wagerlabs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] zeromq

2010-12-16 Thread Joel Reymont
Does anyone have bindings for ZeroMQ?

Thanks, Joel

---
http://twitter.com/wagerlabs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] [Camlp4] Quotation expander with OCaml syntax

2010-07-26 Thread Joel Reymont
What if the quotation is not valid OCaml syntax, e.g. C#, and a Camlp4 parser 
for it exists?

How would I tie it all together to parse the quotation, plug in  antiquotations 
and end up with the custom AST that my parser outputs?

Thanks, Joel

Sent from my iPad

On Jul 26, 2010, at 16:13, Nicolas Pouillard  
wrote:

> On Mon, 26 Jul 2010 16:41:46 +0200, Raphael Proust  
> wrote:
>> Hi all,
> 
> Hi,
> 
>> I'm working on a syntax extension as part of an internship in the
>> Ocsigen team. The aim of the syntax extension is to split the code of a web
>> application in two separate files: one for the client and one for the
>> server. A
>> few transformations are to take place in the process.
>> 
>> Quotations are to be transformed into client code while antiquotations can
>> refer
>> to server side values transmitted to the client at runtime.
>> 
>> 
>> In order to avoid any XY problems, here is an abstracted and simplified
>> example
>> of the expected behavior:
>> 
>> (* Pre-parsed code: *)
>> let start = <:on< f $y$ >> in
>> let html_node =
>> span ~a:[onclick start] "some text" (* a is used for (html) attributes *)
>> 
>> (* Server side post-parsed code: *)
>> let start _arg1 =
>> "call_closure(some_unique_name," ^ mymarshall _arg1 ")"
>> in
>> let html_node = span ~a:[onclick (start y)] "some text"
>> 
>> (* Client side post-parsed code: *)
>> let _ = register_closure some_unique_name (fun _arg1 -> f _arg1)
>> 
>> 
>> 
>> If the example isn't clear enough I can detail it a little bit more.
>> 
>> 
>> I'm unsure of what is the standard way of doing such a thing in Camlp4. What
>> I
>> have in mind is to use the original Ocaml syntax for the quotation expander.
>> This would (IIUC) allow me to filter the AST to transform every
>> antiquotation
>> found inside the quotation itself.
>> 
>> I'm not sure this is the ideal way of doing such a thing because of the size
>> of
>> the pattern matching in the AST filter. On the other hand, because the
>> quotation
>> is supposed to contain valid OCaml code, it seems normal to reuse the
>> original
>> parser.
> 
> If the <:on<...>> contents is valid OCaml syntax I would suggest you to not go
> in the quotations direction. You will avoid a ton of syntactic issues.
> 
> What I suggest you is to directly use camlp4 filters, for instance by changing
> the meaning of some constructor application and labels for antiquotations:
> 
> (* Pre-parsed code: *)
> let start = On (f ~y) in
> let html_node =
>  span ~a:[onclick start] "some text" (* a is used for (html) attributes *)
> 
> Have fun,
> 
> -- 
> Nicolas Pouillard
> http://nicolaspouillard.fr
> 
> ___
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] scalable web apps

2010-07-25 Thread Joel Reymont
How does Ocsigen handle database operations?

I assume they need to be asynchronous because of lightweight threads (Lwt).

Please feel free to point me to the manual but I think an answer in this thread 
would benefit future Google searches.

---
http://twitter.com/wagerlabs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] scalable web apps

2010-07-25 Thread Joel Reymont

On Jul 25, 2010, at 2:52 PM, Dario Teixeira wrote:

> Are we talking about surviving a "mere"
> Slashdot effect (not as scary nowadays as it once was),

This as I'm looking to provide paid conversion of trading strategies from one 
trading language to another. 

See an example conversion of TradeStation Easylanguage C# here:

http://groups.google.com/group/topdog/browse_thread/thread/d5fd8feac8e68331

Note that converted code goes first, followed by original code.

I'm going with naked Ocsigen and Amazon SimpleDB and will tweet (blog?) about 
the process.

Thanks, Joel

---
http://twitter.com/wagerlabs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] scalable web apps

2010-07-24 Thread Joel Reymont
How do you build scalable web apps with OCaml?

Do you use Apache with mod_caml? Naked Ocsigen?

Do you put Ocsigen behind Nginx?

Thanks in advance, Joel

---
http://twitter.com/wagerlabs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] ocaml build error

2010-06-10 Thread Joel Reymont
How do I fix this?

Thanks, Joel

---

Mac OSX 10.6

./build/fastworld.sh
...
+ boot/ocamlyacc -v otherlibs/labltk/compiler/parser.mly
3 shift/reduce conflicts.
+ ./ocamlopt.opt -nostdlib -c -g -warn-error A -I otherlibs/dynlink/nat -I 
stdlib -o otherlibs/dynlink/nat/dynlink.cmx otherlibs/dynlink/nat/dynlink.ml
File "otherlibs/dynlink/nat/dynlink.ml", line 43, characters 0-15:
Error: Unbound module Cmx_format
Command exited with code 2.
Compilation unsuccessful after building 1621 targets (678 cached) in 00:00:31.

---
http://twitter.com/wagerlabs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] vm in ocaml

2010-02-03 Thread Joel Reymont
I have a translator from a Pascal-like trading language written in OCaml and I 
need the output to run as a DLL embedded in a trading platform. 

I'm thinking of generating bytecode and have the user pass the path to the 
bytecode file to the DLL during initialization. 

I don't want to load source code into my runtime since I want to do a lot of 
error checking on it to make sure the runtime experience is smooth. I don't 
want to ship ocamlc, etc. since I want to have a single executable. I'm not 
sure if embedding OCaml (and thus a license!) is needed to generate OCaml 
bytecode in my scenario, so the bytecode I'm talking about is my bytecode.

I understand that a bit of C will be required to wrap the OCaml runtime in a 
DLL. I would prefer to stay with OCaml for the whole project which prompts my 
question... 

Has anyone used OCaml to write a virtual machine?

How big is the OCaml runtime when bundled as a DLL or shared library?

Thanks, Joel

---
http://es.linkedin.com/in/joelreymont

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] problem creating .cma library

2010-01-09 Thread Joel Reymont

On Jan 9, 2010, at 2:02 PM, Daniel Bünzli wrote:

> http://portal.acm.org/citation.cfm?id=1411308

How can I access this paper without an ACM subscription?

Thanks, Joel

---
http://wagerlabs.com



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] ocaml svn build failing on mac osx

2010-01-08 Thread Joel Reymont
Just wanted to say that the svn trunk still has this issue when using 
build/fastworld.sh

http://groups.google.com/group/fa.caml/browse_thread/thread/fe167069116a27a1/77cc1e7c2bdf613e?lnk=gst&q=%22_unix_initgroups%22&pli=1

This patch fixes it and the build finishes

diff --git a/otherlibs/unix/libunix.clib b/otherlibs/unix/libunix.clib
index e6ce2d5..7cfa06b 100644
--- a/otherlibs/unix/libunix.clib
+++ b/otherlibs/unix/libunix.clib
@@ -13,4 +13,4 @@ setgid.o setsid.o setuid.o shutdown.o signals.o
 sleep.o socket.o socketaddr.o
 socketpair.o sockopt.o stat.o strofaddr.o symlink.o termios.o
 time.o times.o truncate.o umask.o unixsupport.o unlink.o
-utimes.o wait.o write.o
+utimes.o wait.o write.o initgroups.o setgroups.o

Thanks, Joel

---
http://wagerlabs.com



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] ocaml as editor extension language

2010-01-04 Thread Joel Reymont
You cannot embed OCaml and use it as an editor extension language unless 

1) your editor is open source, or

2) you are a member of the consortium and pay 2K EUR/year

Is that correct?

Thanks, Joel

---
http://wagerlabs.com



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] ocaml, llvm and generating code at runtime

2010-01-01 Thread Joel Reymont
Does anybody have example code that shows how to generate OCaml bindings at 
runtime with LLVM?

My goal is to compile an AST into code that uses OCaml functions within the 
same binary that's doing the compiling.

I don't think it can be done with OCaml since it requires a standalone 
assembler, linker, etc. Correct me if I'm wrong, though. Mine is a web-based 
compiler with potentially many concurrent sessions. Running gas, ld, etc. seems 
a much heavier and less scalable approach that generating code at runtime.

Thanks and Happy New Year, Joel

---
http://wagerlabs.com

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] huge low-latency ocaml cluster?

2009-05-12 Thread Joel Reymont

Does anyone have an API for Amazon EC2, S3 or SimpleDB?

I need to write an app to push content to hundreds of thousands
of users, connected to a bunch of servers. Think liveblogging.
You push a button and your post needs to be in front of eager
readers within a couple of seconds.

The client-facing interface is Flash sockets and HTTP.

I'm thinking of allocating up to 10k users per server so
clustering is a must. I haven't decided how to ago about it
but I'm wondering if it's time to resurrect Ensemble [1,2]!

Any advice or suggestions?

Thanks, Joel

[1] http://caml.inria.fr/pub/old_caml_site/caml-list/0315.html
[2] http://dsl.cs.technion.ac.il/projects/Ensemble

---
Mac hacker with a performance bent
http://linkedin.com/in/joelreymont

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] arm backend

2009-04-30 Thread Joel Reymont

Is the ARM backend (ocamlopt) usable and actively maintained?

Thanks, Joel

---
Mac hacker with a performance bent
http://linkedin.com/in/joelreymont



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] "ok with parallel threads" GC (aka ocaml for multicore)

2009-04-17 Thread Joel Reymont


On Apr 17, 2009, at 11:15 PM, Philippe Wang wrote:

PS.  We tried to switch to 3.11, but it seems to need too much time,  
it's far from being a piece of cake.
We have tried to make it work on Leopard (actually, I failed the 1st  
time - half the way, I may try again if I have time).



What was the problem with Leopard?

---
Mac hacker with a performance bent
http://linkedin.com/in/joelreymont



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] quasiquoting: 3 parsers for camlp4 vs 1 for haskell?

2009-04-17 Thread Joel Reymont

From the quasiquoting paper by Geoffrey Mainland [1], page 7:

"The major advantage of our approach over that of camlp4
is that we demonstrate how to use generic programming
to reuse a single parser to parse quasiquoted patterns,
quasiquoted expressions and plain syntax that does not
include antiquotes. Because OCaml does not support generic
programming out of the box, in camlp4 this would require
three separate parsers, each generating different
representations of the same concrete syntax."

Can someone shed light on how, where and why three different
parsers are required for camlp4? Is this still the case with 3.11?

Thanks, Joel

[1] http://www.eecs.harvard.edu/~mainland/ghc-quasiquoting/

---
Mac hacker with a performance bent
http://linkedin.com/in/joelreymont



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] quasiquoting and pattern matches

2009-04-17 Thread Joel Reymont

There's an example in the Geoffrey Mainland's Haskell
quasiquotation paper [1] that looks like this:

peep :: [ Asm ] -> [ Asm ]
peep [:asm| mov&s $&r1, &r2
cmp $&r3, &r4
je &lbl |] : rest
  | r3 = r1 ^ r4 = r2
= [:asm|  mov&s $&r1, &r2
  jmp &lbl |] : rest
...

Is it possible to do the same in OCaml, i.e. use
antiquotations in pattern matches?

I have not seen it done this way before, all the
examples match the AST, e.g. from jsgen.ml

let compile_implementation modulename expr =
  let ce =
match expr with
  | Lprim (Psetglobal id, [e]) ->
  enter_setglobal id;
  <:stmt< var $id:jsident_of_ident id$ = $comp_expr false e$;  
>>

  | _ -> unimplemented "compile_implementation" expr in
  let ret = (ce, !reloc_info) in
  reloc_info := [];
  ret

Thanks, Joel

[1] http://www.eecs.harvard.edu/~mainland/ghc-quasiquoting/

---
Mac hacker with a performance bent
http://linkedin.com/in/joelreymont



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] cvs ocaml build failing

2009-04-16 Thread Joel Reymont


On Apr 16, 2009, at 5:50 PM, Stéphane Glondu wrote:


Add initgroups.o and setgroups.o in otherlibs/unix/libunix.clib, then
launch again the compilation.


Seems to help but still bombs out.

./build/fastworld.sh
...
+ boot/ocamlyacc -v ocamldoc/odoc_text_parser.mly
5 shift/reduce conflicts.
Solver failed:
  Ocamlbuild knows of no rules that apply to a target named ocamldoc/ 
odoc_opt.mlast. This can happen if you ask Ocamlbuild to build a  
target with the wrong extension (e.g. .opt instead of .native) or if  
the source files live in directories that have not been specified as  
include directories.

Backtrace:
  - Failed to build the target ocamldoc/ocamldoc.opt
  - Building ocamldoc/ocamldoc.opt:
  - Building ocamldoc/odoc_opt.native:
  - Building ocamldoc/odoc_opt.cmx:
  - Failed to build all of these:
  - Building ocamldoc/odoc_opt.ml:
  - Failed to build all of these:
  - Building ocamldoc/odoc_opt.mlast
  - Building ocamldoc/odoc_opt.ml4
  - Building ocamldoc/odoc_opt.mlbuild
  - Building ocamldoc/odoc_opt.mly
  - Building ocamldoc/odoc_opt.mll
  - Building ocamldoc/odoc_opt.mlpack
Compilation unsuccessful after building 2136 targets (681 cached) in  
00:00:49.



It seems that -lm is missing in BYTECCLIBS and/or NATIVECCLIBS (see
config/Makefile). However, the ./configure script should have done  
this

for you. This might be worth a bugreport.


BYTECCLIBS=   -lcurses -lpthread
NATIVECCLIBS=

This was all working fine before, ocamlbuild and make.


Please pay attention and don't mix both build systems: either use make
or ocamlbuild, but don't run make after having used ocamlbuild nor
vice-versa. To be sure, start from a fresh CVS checkout.



I don't mix and I always do 'make clean', 'make distclean' and './ 
build/distclean.sh'.


Thanks, Joel

---
Mac hacker with a performance bent
http://linkedin.com/in/joelreymont



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] cvs ocaml build failing

2009-04-16 Thread Joel Reymont
./ocamlopt.opt -nostdlib unix.cmxa -g -I stdlib -I otherlibs/unix  
ocamlbuild/ocamlbuild_executor.cmx ocamlbuild/ocamlbuild_pack.cmx  
ocamlbuild/ocamlbuild_unix_plugin.cmx ocamlbuild/ocamlbuild.cmx -o  
ocamlbuild/ocamlbuild.native

Undefined symbols:
  "_unix_setgroups", referenced from:
  _camlUnix__215 in unix.a(unix.o)
  _unix_setgroups$non_lazy_ptr in unix.a(unix.o)
  "_unix_initgroups", referenced from:
  _camlUnix__215 in unix.a(unix.o)
  _unix_initgroups$non_lazy_ptr in unix.a(unix.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
File "caml_startup", line 1, characters 0-1:
Error: Error during linking
Exit code 2 while executing this command:
  ./ocamlopt.opt -nostdlib unix.cmxa -g -I stdlib -I otherlibs/unix  
ocamlbuild/ocamlbuild_executor.cmx ocamlbuild/ocamlbuild_pack.cmx  
ocamlbuild/ocamlbuild_unix_plugin.cmx ocamlbuild/ocamlbuild.cmx -o  
ocamlbuild/ocamlbuild.native


---
Mac hacker with a performance bent
http://linkedin.com/in/joelreymont



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] interface mismatch on camlp4_import

2009-04-15 Thread Joel Reymont


On Apr 15, 2009, at 11:54 AM, Jérémie Dimino wrote:


This may happen if you compiled ocsigen with a different ocaml version
than the one you are using now. Recompiling and reinstalling ocsigen
should fix this error.



Fixed that. What about this?

---
Error: Files /usr/local/lib/ocaml/site-lib/ssl/ssl_threads.cmxa
   and /usr/local/lib/ocaml/threads/threads.cmxa
   make inconsistent assumptions over implementation Thread
---

I rebuilt ocaml from scratch, rebuilt findlib using my freshly built  
ocaml.


I then recompiled ocamlnet and ocamlssl, cleaned ocsigen and  
recompiled it.


The error above does not go away!

Thanks, Joel

---
Mac hacker with a performance bent
http://linkedin.com/in/joelreymont



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] interface mismatch on camlp4_import

2009-04-15 Thread Joel Reymont
Camlp4: Uncaught exception: DynLoader.Error ("/usr/local/lib/ocaml/ 
site-lib/ocsigen/xhtmlsyntax.cma", "interface mismatch on  
Camlp4_import")


What does this mean and how do I fix it?

Thanks, Joel

---
Mac hacker with a performance bent
http://linkedin.com/in/joelreymont



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] antiquotations for c#

2009-04-15 Thread Joel Reymont

Suppose I have a camlp4 parser for C#.

I want to include bits of C# in my code and end up with the AST.

I want to have "holes" in the above AST to plug in values.

I understand that antiquotations take car of filling the holes in the  
AST,

any tips on implementing this, though?

Thanks, Joel

---
Mac hacker with a performance bent
http://linkedin.com/in/joelreymont



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] Re: LLC book [was: Questions]

2009-04-02 Thread Joel Reymont


On Apr 2, 2009, at 7:08 PM, Richard Jones wrote:


So you might want to think about an alternate method of authorship,
such as a version-controlled, shared document, that allows
contributions and comes under a Free license of some sort.


Like the Django Book!

http://www.djangobook.com/

---
Mac hacker with a performance bent
http://linkedin.com/in/joelreymont



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] Google summer of Code proposal

2009-03-30 Thread Joel Reymont

There's a nice discussion of LLVM in the context of Alice ML here:

http://lambda-the-ultimate.org/node/440

I'm told that not much has changed since.

---
http://tinyco.de
Mac, Lisp, OCaml




___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] native GTK+ on Mac OS X

2009-03-30 Thread Joel Reymont


On Mar 30, 2009, at 3:08 PM, Kuba Ober wrote:


I'm running native gimp and other tools, and it all "just works", so  
I don't

really see why you'd even need the x11 gtk.



Does Glade work as well?

Have you tried using Glade-built GUIs with OCaml?

Thanks, Joel

---
http://tinyco.de
Mac, Lisp, OCaml




___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] qt / windows gui

2009-03-30 Thread Joel Reymont


On Mar 30, 2009, at 7:41 AM, Grünewald Michaël wrote:


Did you have Gtk+ working natively in OSX?



I do but I built from source after downloading the GTK+/OSX frameworks  
and using ./configure --with-quartz


I also had to place the following two (identical) files in /opt/local/ 
lib/pkgconfig since my pkg-config comes from MacPorts:


gtk+-2.0.pc, gtk+-quartz-2.0.pc:

prefix=/opt/local
exec_prefix=${prefix}
datarootdir = @datarootdir@
bindir=${exec_prefix}/bin
libdir=${exec_prefix}/lib
libexecdir=${exec_prefix}/libexec
includedir=${prefix}/include
datadir=/opt/local/share/doc

Name: GTK+
Description: a modern implementation of DBM
Version: 2.14.3
Libs: -framework Gtk -framework GLib -framework Cairo
Cflags: -I/Library/Frameworks/Gtk.framework/Headers -I/Library/ 
Frameworks/GLib.framework/Headers -I/Library/Frameworks/ 
Cairo.framework/Headers



---
http://tinyco.de
Mac, Lisp, OCaml




___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] ocaml + non-cygwin gtk+ on windows

2009-03-27 Thread Joel Reymont

Has anyone used ocaml and gtk+ to build non-cygwin app for windows?

These would be gtk+ apps that don't require the x server.

What toolchain did you use?

Thanks, Joel

---
http://linkedin.com/in/joelreymont



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] qt / windows gui

2009-03-25 Thread Joel Reymont

Are there OCaml bindings for QT?

Would OCaml + QT be a good option for a Windows app?

I don't want to go with F# and do want to keep development on the Mac.

Thanks, Joel

---
http://linkedin.com/in/joelreymont



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] Reference to undefined global `Dynlink'

2009-03-24 Thread Joel Reymont
I have a feeling that I have seen this before but I don't remember how  
to fix it.


Any suggestions?

Thanks, Joel

---

ocamlfind ocamlmktop -thread -package  
lwt.ssl,lwt.extra,netstring,netsys,ssl,pcre,unix,threads,findlib -I ../ 
baselib -I ../http -I ../xmlp4 -I ../server -I ../extensions -I ../ 
eliom -I +camlp4 -I +camlp4/Camlp4Parsers -o ocsigentop -linkpkg - 
linkall ../baselib/parsecommandline.cma camlp4lib.cma  
Camlp4OCamlRevisedParser.cmo Camlp4OCamlParser.cmo ../xmlp4/ 
xhtml.cma ../xmlp4/xhtmlpretty.cma ocsigen.cma

File "/tmp/findlib_initl45acd4.ml", line 1, characters 0-1:
Error: Error while linking /opt/local/lib/ocaml/camlp4/ 
camlp4lib.cma(Camlp4):

Reference to undefined global `Dynlink'
gmake[1]: *** [ocsigentop] Error 2
gmake[1]: Leaving directory `/home/fjj67yaa/ocaml/ocsigen/server'
gmake: *** [server.byte] Error 2

---
http://tinyco.de
Mac, Lisp, OCaml




___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] Re: ocamlnet on solaris 5.11

2009-03-23 Thread Joel Reymont

This is the error that I get trying to compile ocamlnet on solaris 5.11

gmake
gmake: *** No rule to make target `netsys_posix.cmo', needed by  
`netsys.cma'.  Stop.


I can't figure out how netsys_posix.cmo gets produced.

---
http://linkedin.com/in/joelreymont



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] ocamlnet on solaris 5.11

2009-03-23 Thread Joel Reymont

Has anyone managed to build ocamlnet on solaris 5.11?

I think ocamlnet makes the assumption that solaris is sunos (bsd)  
whereas it's sysv after 4.x.


Thanks, Joel

---
http://linkedin.com/in/joelreymont



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] Google summer of Code proposal

2009-03-21 Thread Joel Reymont


On Mar 21, 2009, at 2:51 PM, Jon Harrop wrote:

. I found that LLVM's x86 backend breaks tail calls when the return  
type is a
first class struct. The workaround is to use sret form, having the  
caller
preallocate the return struct and passing a pointer to the struct as  
an extra

first argument.



Returning a structure by having the caller preallocate space, etc. is  
part of the Intel ABI or something like that. This is how it's done,  
period.


Not sure how it relates to breaking tail calls, though.

---
http://linkedin.com/in/joelreymont



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] Google summer of Code proposal

2009-03-21 Thread Joel Reymont


On Mar 21, 2009, at 1:38 PM, Jon Harrop wrote:

. You will succumb to ocamlopt's current run-time representation  
which is
objectively inefficient (e.g. boxing floats, tuples, records) and  
was only
chosen because the compiler lacks capabilities that LLVM already  
provides for

you (primarily JIT compilation).



This is probably a stupid suggestion but why not have OCaml directly  
generate machine code, without the use of assembler and linker?


Wouldn't this be easier than trying to couple OCaml with LLVM?

Separately, it's sort of funny that LLVM and its users are going  
through all the trouble now, when Lisp and Forth have had runtime  
compilation for years and years.


---
http://linkedin.com/in/joelreymont



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] Problem during Godi bootstrap_stage2 (Windows mingw)

2009-03-19 Thread Joel Reymont

What about this error with Cygwin towards the end of bootstrap_stage2?

Thanks, Joel

---

cp ld.conf /usr/local/godi/build/godi/godi-ocaml/work/stage/lib/ocaml/ 
std-lib/ld

.conf
cp libcamlrun_shared.so /usr/local/godi/build/godi/godi-ocaml/work/ 
stage/lib/oca

ml/std-lib/libcamlrun_shared.so
cp: cannot stat `libcamlrun_shared.so': No such file or directory
make[9]: *** [install] Error 1
make[9]: Leaving directory `/usr/local/godi/build/godi/godi-ocaml/work/ 
ocaml/byt

erun'
make[8]: *** [install] Error 2
make[8]: Leaving directory `/usr/local/godi/build/godi/godi-ocaml/work/ 
ocaml'
Error: Exec error: File /usr/local/godi/build/godi/godi-ocaml/./../../ 
mk/bsd.pkg

.mk, line 1067: Command returned with non-zero exit code
Error: Exec error: File /usr/local/godi/build/godi/godi-ocaml/./../../ 
mk/bsd.pkg

.mk, line 1179: Command returned with non-zero exit code
Error: Exec error: File /usr/local/godi/build/godi/godi-ocaml/./../../ 
mk/bsd.pkg

.mk, line 1456: Command returned with non-zero exit code
Error: Exec error: File /usr/local/godi/build/godi/godi-ocaml/./../../ 
mk/bsd.pkg

.mk, line 1384: Command returned with non-zero exit code
Error: Command fails with code 1: godi_console
Failure!

---
http://tinyco.de
Mac, Lisp, OCaml




___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] problem building godi on solaris

2009-03-19 Thread Joel Reymont
I'm trying to build GODI on Solaris. I already have OCaml 3.10 built  
but don't see a way to use it to bootstrap GODI.


Any suggestions how to fix the error below or make GODI use the OCaml  
I have installed?


Thanks, Joel

---

Press [Return] to begin with the installation; press [CTRL-C] to abort.
>
===> Creating sample godi.conf
===> Building ocamlrun
Failure! (See bootstrap.log for details)

cat bootstrap.log
...
cd byterun; make libcamlrun.a
make: Warning: Can't find `../config/Makefile': No such file or  
directory
Current working directory /home/fjj67yaa/godi-rocketboost-20080630/run/ 
ocamlrun-3.09.3/byterun
make: Fatal error in reader: Makefile, line 16: Read of include file  
`../config/Makefile' failed
Current working directory /home/fjj67yaa/godi-rocketboost-20080630/run/ 
ocamlrun-3.09.3/byterun

*** Error code 1
make: Fatal error: Command failed for target `build'

---
http://tinyco.de
Mac, Lisp, OCaml




___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] fail: building ocaml / godi on windows

2009-03-17 Thread Joel Reymont

I just tried to build GODI 3.10 and OCaml from CVS on Windows/Cygwin.

GODI failed at the detecting compiler arguments stage, right after  
writing META files for libraries. OCaml failed to build byterun/ 
win32.c since it couldn't figure out the storage size of 'fileinfo'.


---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] native compilation: no implementation provided for dynlink?

2009-03-17 Thread Joel Reymont

ocaml -version
The Objective Caml toplevel, version 3.12.0+dev2 (2009-01-25)

Do you mean to recompile them with 3.11?

I compiled with 3.12.

On Mar 17, 2009, at 6:36 PM, Martin Jambon wrote:


Joel Reymont wrote:

How do I fix this?


Upgrade ocamlfind/findlib for 3.11.


---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] native compilation: no implementation provided for dynlink?

2009-03-17 Thread Joel Reymont

How do I fix this?

Thanks, Joel

---

+ ocamlfind ocamlopt -package 'extlib, dynlink, camlp4.lib' -linkpkg - 
g src/easy_ast.cmx src/easy_lexer.cmx src/token.cmx src/static1.cmx  
src/easy_parser.cmx src/easy_symtab.cmx src/easy_typer.cmx src/ 
ninja_ast.cmx src/ninja_morpher.cmx src/pretty.cmx src/ 
ninja_printer.cmx src/topdog.cmx -o src/topdog.native

File "_none_", line 1, characters 0-1:
Error: No implementations provided for the following modules:
 Dynlink referenced from /usr/local/lib/ocaml/camlp4/ 
camlp4lib.cmxa(Camlp4)


---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] dll from ocaml code

2009-03-16 Thread Joel Reymont
Does anyone have a recipe for packaging OCaml code as a DLL or shared  
library?


I need to be able to expose a few entry points that correspond to  
OCaml functions.


Thanks, Joel

---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] camlp4: rules with arguments?

2009-03-13 Thread Joel Reymont

I have two rules designed to parse these statements

buy 100 shares next bar at market
buy 100 shares # assumes next bar at market
sell 100 shares next bar 20 stop
...

The rules are the same, except "Higher" and "Lower" get swapped when  
combined with "Stop" and "Limit".


Since either buyMethod or sellMethod is optional, the rules are used  
as "OPT buyMethod" and "OPT sellMethod".


Is there a way to parameterize these rules or should I keep them as is?

Can the rules be simplified?

Thanks, Joel

---

  buyMethod:
  [
[ "Next"; "Bar";
  x = [ x = [ at = OPT "At$"; e = expr; [ "Stop" | "Higher" ] ->  
(Stop e, at)
  | at = OPT "At$"; e = expr; [ "Limit" | "Lower" ] -> (Limit  
e, at)

  | "Market" -> (Market, None)
  ] -> x
  | -> (Market, None)
  ] -> x
]
  ];

  sellMethod:
  [
[ "Next"; "Bar";
  x = [ x = [ at = OPT "At$"; e = expr; [ "Stop" | "Lower" ] ->  
(Stop e, at)
  | at = OPT "At$"; e = expr; [ "Limit" | "Higher" ] ->  
(Limit e, at)

  | "Market" -> (Market, None)
  ] -> x
  | -> (Market, None)
  ] -> x
]
  ];

---
http://tinyco.de
Mac, C++, OCaml

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] camlp4: precedence, LEFTA, NONA, etc.

2009-03-12 Thread Joel Reymont

What about this quote from the camlp4 manual?

"An entry is composed of entry precedence levels, the first one being  
the least precedent and the last one the most."


I'm assuming that my expr counts as one rule where '+' and '=' have  
lesser precedence than 'and' and '*' since those follow after.


On Mar 12, 2009, at 9:13 AM, blue storm wrote:


To my understanding, precendence levels correspond to the level you
define in the grammar, in the given order : in your case, you have
"=", "+" at the same level, with higher precendence than "And" and
"*".


---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] camlp4: precedence, LEFTA, NONA, etc.

2009-03-12 Thread Joel Reymont


On Mar 12, 2009, at 9:13 AM, blue storm wrote:


You should reverse your rules (starting with the
higher-precendence construnction instead of the atomic values), and
possibly split some of your level into different levels (eg. "<" and
"+") for finer-grained precedence.



I have it reversed then as I thought the rules went in increasing  
order of precedence :-(. Thanks for correcting me!


---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] camlp4: precedence, LEFTA, NONA, etc.

2009-03-11 Thread Joel Reymont
I'm trying to properly set up the precedence in my expression camlp4  
rule.


It's not working properly, though.

(* wrong!!! > has higher prec than and*)
# parse_with_rule expr "1 > 2 and 3 > 4";;
- : Easy_ast.expr = Cond (Int 1, GT, And (Int 2, Cond (Int 3, GT, Int  
4)))


(* right! mul is higher than plus *)
# parse_with_rule expr "1 + 2 * 3";;
- : Easy_ast.expr = Plus (Int 1, Mul (Int 2, Int 3))

(* wrong!!! > should be higher than + *)
# parse_with_rule expr "1 + 2 > 3";;
- : Easy_ast.expr = Plus (Int 1, Cond (Int 2, GT, Int 3))

(* wrong!!! mul should be higher than and *)
# parse_with_rule expr "1 * 2 and 3 * 4";;
- : Easy_ast.expr = Mul (Int 1, And (Int 2, Mul (Int 3, Int 4)))

(* right!!! *)
# parse_with_rule expr "1 * not 2";;
- : Easy_ast.expr = Mul (Int 1, Not (Int 2))

Here's my rule. What am I doing wrong?

Thanks, Joel

---

 expr:
  [ NONA
[ (x, _) = INT -> Int x
| (x, _) = FLOAT -> Float x
| (s, _) = STRING -> Str s
| "true" -> Bool true
| "false" -> Bool false
| a = IDENT; "["; b = exprl; "]"; c = OPT ago ->
Var (a, b, c)
| a = IDENT; b = OPT ago ->
  Var (a, [], b)
| "("; e = expr; ")" -> Group e
]
  | LEFTA
[ e1 = expr; "="; e2 = expr -> Cond (e1, EQ, e2)
| e1 = expr; "<="; e2 = expr -> Cond (e1, LE, e2)
| e1 = expr; ">="; e2 = expr -> Cond (e1, GE, e2)
| e1 = expr; "<"; e2 = expr -> Cond (e1, LT, e2)
| e1 = expr; ">"; e2 = expr -> Cond (e1, GT, e2)
| e1 = expr; "<>"; e2 = expr -> Cond (e1, NEQ, e2)
| e1 = expr; "+"; e2 = expr -> Plus (e1, e2)
| e1 = expr; "-"; e2 = expr -> Minus (e1, e2)
| "-"; e = expr -> UniMinus e
]
  | LEFTA
[ e1 = expr; "Or"; e2 = expr -> Or (e1, e2)
| e1 = expr; "And"; e2 = expr -> And (e1, e2)
| e1 = expr; "Mod"; e2 = expr -> Mod (e1, e2)
| e1 = expr; "*"; e2 = expr -> Mul (e1, e2)
| e1 = expr; "/"; e2 = expr -> Div (e1, e2)
| e = expr; [ "Points"; "Point" ]; i = OPT instr -> Points (e, i)
| "Not"; e = expr -> Not e
]
  ];

---
http://tinyco.de
--- Mac & iPhone





___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] camlp4: how do you write this rule?

2009-03-11 Thread Joel Reymont
I would like my expression rule to parse "1 + 2 points" as "Plus (1,  
Points 2)".


I currently have the following, with Points right-associative and at  
the bottom, but it doesn't work. Is this something that Camlp4 can  
handle?


Thanks, Joel

expr:
  [ ...
  | LEFTA
[ e1 = expr; "Or"; e2 = expr -> Or (e1, e2)
| e1 = expr; "And"; e2 = expr -> And (e1, e2)
| e1 = expr; "Mod"; e2 = expr -> Mod (e1, e2)
| e1 = expr; "*"; e2 = expr -> Mul (e1, e2)
| e1 = expr; "/"; e2 = expr -> Div (e1, e2)
| "Not"; e = expr -> Not e
]
  | RIGHTA
[ e = expr; [ "Points"; "Point" ]; i = OPT instr -> Points (e, i) ]
  ];

---
http://tinyco.de
--- Mac & iPhone





___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] ocaml resurgence?

2009-03-11 Thread Joel Reymont

Is it just me or there's a fresh uptake of OCaml among bright people?

I used to have to wait a long time (hours?) to get my questions  
answered and now I get them answered in just a few minutes. And I'm  
not talking simple questions since I don't consider camlp4 anywhere  
simple. Woot!


I believe things are ideally balanced at the moment: response is  
prompt but the list traffic is not as high as for Haskell.


---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] Reference to undefined global `Camlp4_config'

2009-03-11 Thread Joel Reymont


On Mar 11, 2009, at 2:04 PM, Jérémie Dimino wrote:

If you want to use the camlp4 library you must use the "camlp4.lib"  
package instead.



That solves it, thanks!

---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: Re : [Caml-list] Reference to undefined global `Camlp4_config'

2009-03-11 Thread Joel Reymont


On Mar 11, 2009, at 1:33 PM, Matthieu Wipliez wrote:



I'm not familiar with ocamlfind, but for Camlp4 you need this:
 -I +camlp4 camlp4lib.cma


I was under the impression that ocamlfind -packages takes care of  
adding the camlp4 bits.



Does this solve the problem?



Not really but thanks for trying! The ocamlfind command that  
ocamlbuild is using, e.g.


+ ocamlfind ocamlc -verbose -package 'oUnit, extlib, camlp4' -linkpkg - 
g src/easy_ast.cmo src/easy_code.cmo src/easy_lexer.cmo src/ 
easy_symtab.cmo src/token.cmo src/static1.cmo src/easy_parser.cmo src/ 
test_tools.cmo src/parser_test.cmo src/test.cmo -o src/test.byte


Boils down to this

Effective set of compiler predicates:  
pkg_unix,pkg_oUnit,pkg_extlib,pkg_camlp4,autolink,byte
+ ocamlc.opt -verbose -g -o src/test.byte -I /usr/local/lib/ocaml/site- 
lib/oUnit -ccopt -I/usr/local/lib/ocaml/site-lib/oUnit -I /usr/local/ 
lib/ocaml/site-lib/extlib -ccopt -I/usr/local/lib/ocaml/site-lib/ 
extlib -I /usr/local/lib/ocaml/camlp4 -ccopt -I/usr/local/lib/ocaml/ 
camlp4 -ccopt -L/usr/local/lib/ocaml/site-lib/oUnit -ccopt -L/usr/ 
local/lib/ocaml/site-lib/extlib -ccopt -L/usr/local/lib/ocaml/camlp4 / 
usr/local/lib/ocaml/unix.cma /usr/local/lib/ocaml/site-lib/oUnit/ 
oUnit.cma /usr/local/lib/ocaml/site-lib/extlib/extLib.cma src/ 
easy_ast.cmo src/easy_code.cmo src/easy_lexer.cmo src/easy_symtab.cmo  
src/token.cmo src/static1.cmo src/easy_parser.cmo src/test_tools.cmo  
src/parser_test.cmo src/test.cmo

File "_none_", line 1, characters 0-1:
Error: Error while linking src/easy_lexer.cmo:
Reference to undefined global `Camlp4_config'
ocamlc.opt returned with exit code 2
Command exited with code 2.

It's using camlp4 for -I and -L but it's not pulling in the library  
for some reason.


Thanks, Joel

---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] Reference to undefined global `Camlp4_config'

2009-03-11 Thread Joel Reymont

Any suggestions on how to resolve this?

ocamlfind installs into /usr/local/lib/site-lib and there's a site-lib/ 
camlp4 directory with META in it.


Thanks, Joel

---

ocamlfind ocamlc -package 'oUnit, extlib, camlp4' -linkpkg -g src/ 
easy_ast.cmo src/easy_code.cmo src/easy_lexer.cmo src/easy_symtab.cmo  
src/token.cmo src/static1.cmo src/easy_parser.cmo src/test_tools.cmo  
src/parser_test.cmo src/test.cmo -o src/test.byte

File "_none_", line 1, characters 0-1:
Error: Error while linking src/easy_lexer.cmo:
Reference to undefined global `Camlp4_config'

---
http://tinyco.de
--- Mac & iPhone





___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] camlp4 grammar and LIST1

2009-03-10 Thread Joel Reymont


On Mar 10, 2009, at 11:01 PM, Jake Donham wrote:


An approach
that works for me is to think "recursive descent" and always give
rules that check at least one token before branching to another rule.



Something like this then?

  sellMethod:
  [
[ "Next"; "Bar"; at = OPT "At$"; e = expr;
  f = [ [ "Stop" | "Lower" ] -> fun x -> Stop x
  | [ "Limit" | "Higher" ] -> fun x -> Limit x
  ] -> (f e, at)
]
  ];


---
http://tinyco.de
--- Mac & iPhone





___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] camlp4 grammar and LIST1

2009-03-10 Thread Joel Reymont


On Mar 10, 2009, at 9:48 PM, Jake Donham wrote:


statement: [ [ s = openStatement -> s | s = closedStatement -> s ] ];


Syntactically it is fine but I don't think this is going to do what
you want. Camlp4 parsers aren't backtracking; you have to distinguish
openStatement from closedStatement by parsing a token.


I have it like this at the moment. Are you saying it won't work?

What does it mean to parse a token then?

Does that token have to be in the same rule?

Thanks, Joel

---

  statement: [ [ openStatement | closedStatement ] ];

  openStatement: [ [ openIfStatement ] ];

  openIfStatement:
  [
[ "If"; e = expr; "Then"; s1 = closedStatement; "Else"; s2 =  
openStatement -> If (e, s1, s2)

| "If"; e = expr; "Then"; s = statement -> If (e, s, Skip)
]
  ];

  closedIfStatement:
  [
[ "If"; e = expr; "Then"; s1 = closedStatement; "Else"; s2 =  
closedStatement -> If (e, s1, s2) ]

  ];

  closedStatement:
  [
[ inputDeclarations
| varDeclarations
| arrayDeclarations
| compoundStatement
| assignment
| closedIfStatement
| whileStatement
| forStatement
| tradeStatement
| preprocessorStatement
| procCall
]
  ];

  inputDeclarations:
  [
[ "Input"; ":";
  l = LIST1 [ x = inputDeclaration -> x ] SEP "," -> InputDecls l
]
  ];
  ...

---
http://tinyco.de
--- Mac & iPhone





___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] camlp4 grammar and LIST1

2009-03-10 Thread Joel Reymont

In the following bit of camlp4 grammar

  inputDeclarations:
  [
[ "Input"; ":";
  l = LIST1 inputDeclaration SEP "," -> l
]
  ];

Is it always necessary to write [ x = inputDeclaration -> x ] instead  
of just inputDeclaration?


I'm trying to debug the type of each rule and I'm often getting  
complaints about 'unit list' being used instead of just 'statement'.


By the same token, can I shorten the gramar below to just  
[ openStatement | closedStatement ]?


  statement: [ [ s = openStatement -> s | s = closedStatement -> s ] ];

How do you folks debug grammar rule types?

Thanks, Joel

---
http://tinyco.de
--- Mac & iPhone





___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: Re : Re : [Caml-list] Re: camlp4 stream parser syntax

2009-03-08 Thread Joel Reymont


On Mar 8, 2009, at 5:04 PM, Matthieu Wipliez wrote:


In the parser, did you replace
 module Gram = Camlp4.Struct.Grammar.Static.Make(Lexer)
by
 module Gram = Static1.Make(Lexer)



I forgot to fix match_keyword. Works otherwise, thanks!

Now, why is match_keyword supplied with the original keyword, e.g.  
"Delay" when the lower case version of that is supposed to be inserted  
into the hash table?


---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: Re : [Caml-list] Re: camlp4 stream parser syntax

2009-03-08 Thread Joel Reymont


On Mar 8, 2009, at 3:55 PM, Matthieu Wipliez wrote:

Well I just duplicated Static to Static1 (and added  
Camlp4.Struct.Grammar where necessary) and replaced:

 module Structure = Camlp4.Struct.Grammar.Structure.Make Lexer;
by:


Something like this you mean? I must be doing something wrong as I  
never see my printout from 'using'.


Thanks, Joel

--- Static1.ml ---

open Camlp4;
open Struct;
open Grammar;

value uncurry f (x,y) = f x y;
value flip f x y = f y x;

module Make (Lexer : Sig.Lexer)
: Sig.Grammar.Static with module Loc = Lexer.Loc
and module Token = Lexer.Token
= struct
  module Structure = struct
include Camlp4.Struct.Grammar.Structure.Make Lexer;

value using { gkeywords = table; gfilter = filter } kwd =
  let _ = print_endline ("using: storing " ^ String.lowercase  
kwd) in

  let kwd = String.lowercase kwd in
  let r = try Hashtbl.find table kwd with
[ Not_found ->
  let r = ref 0 in do { Hashtbl.add table kwd r; r } ]
  in do { Token.Filter.keyword_added filter kwd (r.val = 0);  
incr r };

  end;
  module Delete = Delete.Make Structure;
  module Insert = Insert.Make Structure;
  module Fold = Fold.Make Structure;
  include Structure;

  value gram =
let gkeywords = Hashtbl.create 301 in
{
  gkeywords = gkeywords;
  gfilter = Token.Filter.mk (Hashtbl.mem gkeywords);
  glexer = Lexer.mk ();
  warning_verbose = ref True; (* FIXME *)
  error_verbose = Camlp4_config.verbose
};

  module Entry = struct
module E = Entry.Make Structure;
type t 'a = E.t 'a;
value mk = E.mk gram;
value of_parser name strm = E.of_parser gram name strm;
value setup_parser = E.setup_parser;
value name = E.name;
value print = E.print;
value clear = E.clear;
value dump = E.dump;
value obj x = x;
  end;

  value get_filter () = gram.gfilter;

  value lex loc cs = gram.glexer loc cs;

  value lex_string loc str = lex loc (Stream.of_string str);

  value filter ts = Token.Filter.filter gram.gfilter ts;

  value parse_tokens_after_filter entry ts =  
Entry.E.parse_tokens_after_filter entry ts;


  value parse_tokens_before_filter entry ts =  
parse_tokens_after_filter entry (filter ts);


  value parse entry loc cs = parse_tokens_before_filter entry (lex  
loc cs);


  value parse_string entry loc str = parse_tokens_before_filter entry  
(lex_string loc str);


  value delete_rule = Delete.delete_rule;

  value srules e rl =
Stree (List.fold_left (flip (uncurry (Insert.insert_tree e)))  
DeadEnd rl);

  value sfold0 = Fold.sfold0;
  value sfold1 = Fold.sfold1;
  value sfold0sep = Fold.sfold0sep;
  (* value sfold1sep = Fold.sfold1sep; *)

  value extend = Insert.extend;

end;

---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] Re: camlp4 stream parser syntax

2009-03-08 Thread Joel Reymont


On Mar 8, 2009, at 3:32 PM, Matthieu Wipliez wrote:

I'd say duplicate Static, and redefine "using". Seems like the  
simplest solution to me, certainly not the cleanest though (but is  
there an alternative?).



I don't think this will work elegantly.

Static first makes a Structure (is make the right term?) and then  
makes a bunch of other modules using it. A custom Structure will be  
needed to downcase the keywords before inserting them into the hash  
table, so Static will need to be duplicated as well.


I'm learning modules, functors, etc. Perhaps someone more experienced  
in this and camlp4 can weight in.


Thanks, Joel

-- Static.ml --- 


module Make (Lexer : Sig.Lexer)
: Sig.Grammar.Static with module Loc = Lexer.Loc
and module Token = Lexer.Token
= struct
  module Structure = Structure.Make Lexer;
  module Delete = Delete.Make Structure;
  module Insert = Insert.Make Structure;
  module Fold = Fold.Make Structure;
  include Structure;

---
http://tinyco.de
Mac, C++, OCaml

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] Re: camlp4 stream parser syntax

2009-03-08 Thread Joel Reymont


On Mar 8, 2009, at 3:32 PM, Matthieu Wipliez wrote:

I'd say duplicate Static, and redefine "using". Seems like the  
simplest solution to me, certainly not the cleanest though (but is  
there an alternative?).



Now we are talking!

This is Static.ml:

module Make (Lexer : Sig.Lexer)
: Sig.Grammar.Static with module Loc = Lexer.Loc
  and module Token = Lexer.Token
= struct

  module Structure = Structure.Make Lexer;
  module Delete = Delete.Make Structure;
  module Insert = Insert.Make Structure;
  module Fold = Fold.Make Structure;
  include Structure;
...
  value get_filter () = gram.gfilter;
...
  value extend = Insert.extend;
end;

I read the documentation for 'include' but couldn't quite grasp  
whether the included interface was exported from that module that's  
including. Given that 'get_filter' is available but 'using', I reckon  
the answer is NO.


What if Static1 included Static after making it, then included  
Structure again and defined its own using in terms of the one provided  
by Structure?


---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: Re : Re : [Caml-list] Re: camlp4 stream parser syntax

2009-03-08 Thread Joel Reymont


On Mar 8, 2009, at 3:07 PM, Matthieu Wipliez wrote:

I believe there is a (partially acceptable) solution, if you are  
willing to accept having all your keywords in lower-case in the  
grammar (not in the lexer), ie you match against "buyorsell",  
"sellshort" etc.


Nope, I want camel case! :D I think a functor or something like that  
is called for here. There must be a way to include Structure into a  
module to redefine 'using', without having to duplicate  
Camlp4.Struct.Grammar.Static.Make!


The problem is that Static includes Structure.

I haven't figured out a solution yet.

I already downcase the idents in the lexer, what I want is to use  
camel case in the camlp4 parser and have that be stored as lower case  
in the internal hash table.


Thanks, Joel

---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: Re : [Caml-list] Re: camlp4 stream parser syntax

2009-03-08 Thread Joel Reymont


On Mar 8, 2009, at 2:09 PM, Matthieu Wipliez wrote:


using a single rule, say
 buy : [ [ "buyOrSell"; ... ] ]


Yes, I want camel-case above.


and at lexing time do
 if String.lowercase s = "buyorsell" then
   IDENT "buy_or_sell"
 else
   IDENT s



And this is the part that I object to. I have quite a number of  
keywords and I don't want to have a bunch of if statements or have a  
hash table mapping lowercase to camel case. This would mean having to  
track the parser (camel case) version in two places: the lexer and the  
parser.


What I want is to extend Camlp4.Struct.Grammar.Static with a custom  
version of Make that applies String.lowercase before giving the string  
to 'using' to be inserted into the keywords table.


Thanks, Joel

---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] Re: camlp4 stream parser syntax

2009-03-08 Thread Joel Reymont


On Mar 8, 2009, at 1:33 PM, Matthieu Wipliez wrote:

So to sum up: when you declare a rule with a token "MyToken", the  
grammar is configured to recognize a "MyToken" keyword.


The issue here is that it must be lower case in the camlp4 rules, i.e.  
"mytoken".


What if I want to have "MyToken" (camel-case) in the rule and have it  
be low-cased when the grammar is extended? I think that requires  
extending one of the Camlp4 modules or it won't work.


Also, using is not directly accessible and neither is the keywords  
hash table or is_kwd. You _can_ get the filter with get_filter () but  
the resulting structure is not mutable so you can't wrap is_kwd to low- 
case the string passed to it.


---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: Re : Re : Re : [Caml-list] Re: camlp4 stream parser syntax

2009-03-08 Thread Joel Reymont


On Mar 8, 2009, at 11:45 AM, Matthieu Wipliez wrote:

In this case, here is a possible solution, you have your hash table  
associate a lowercase version of the token with what you'd like to  
use in the grammar:

"buytocover" => "BuyToCover"
"sellshort" => "SellShort"
...



I'm doing this already but I don't think it will do the trick with a  
camlp4 parser since it goes through is_kwd to find a match when you  
use "delay".


I think that the internal keyword hash table in the grammar needs to  
be populated with lowercase keywords (by invoking 'using'). I don't  
know how to get to the 'using' function yet, though.


Thanks, Joel

---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: Re : [Caml-list] Re: camlp4 stream parser syntax

2009-03-08 Thread Joel Reymont


On Mar 8, 2009, at 10:35 AM, Joel Reymont wrote:

The filter module nested in the token module seems like a good  
candidate. What functions of the lexer or filter are accessed when a  
string keyword (e.g. "delay") is found in the camlp4 grammar?



The filter portion of the token module looks like this (more below) ...

  module Token = struct
module Loc = Loc

type t = token

...

module Filter = struct
  type token_filter = (t, Loc.t) Camlp4.Sig.stream_filter

  type t =
{ is_kwd : string -> bool;
  mutable filter : token_filter }

  let mk is_kwd =
{ is_kwd = is_kwd;
  filter = fun s -> s }

  let keyword_conversion tok is_kwd =
match tok with
  SYMBOL s | IDENT s when is_kwd s -> KEYWORD s
| _ -> tok

  ...
end
  end

The relevant part here is the function is_kwd : (string -> bool)  
that's passed to Filter.mk. Within the bowels of OCaml a keyword hash  
table is set up and used to manage keywords, e.g gkeywords in gram  
below.


The functions using and removing (below) can be used to add and remove  
keywords.


module Structure =
  struct
open Sig.Grammar

module type S =
  sig
module Loc : Sig.Loc

module Token : Sig.Token with module Loc = Loc

module Lexer : Sig.Lexer with module Loc = Loc
  and module Token = Token

module Context : Context.S with module Token = Token

module Action : Sig.Grammar.Action

type gram =
  { gfilter : Token.Filter.t;
gkeywords : (string, int ref) Hashtbl.t;
glexer :
  Loc.t -> char Stream.t -> (Token.t * Loc.t) Stream.t;
warning_verbose : bool ref; error_verbose : bool ref
  }

type efun =
  Context.t -> (Token.t * Loc.t) Stream.t -> Action.t

type token_pattern = ((Token.t -> bool) * string)

type internal_entry = ...

type production_rule = ((symbol list) * Action.t)

...

val get_filter : gram -> Token.Filter.t

val using : gram -> string -> unit

val removing : gram -> string -> unit

  end

Matthieu is using this bit to parse

let parse_arg str =
parse_with_msg Gram.parse arg (Loc.mk str) (Stream.of_string str)

Should I just invoke Gram.using ... ? I feel that the solution is  
staring me in the face here but I still can't recognize it. Help!!!


Thanks, Joel


---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: Re : [Caml-list] Re: camlp4 stream parser syntax

2009-03-08 Thread Joel Reymont


On Mar 8, 2009, at 10:27 AM, Daniel de Rauglaudre wrote:


Only changing the "tok_match" record field (2nd point) would not work
for keywords (defined by "just a string" in Camlp* grammars), because
the lexer *must* recognize all combinations of the identifier as
keywords, implying a change, anyway, in the lexer.



This is precisely what I'm trying to figure out.

What do I have to change in my _custom_ lexer generated by ocamllex to  
recognize keywords defined by just a string in camlp4 grammars. I'm  
not using LIDENT, etc. as I have my own set of tokens.


I understand that I need to downcase the keyword (or upcase) but I  
don't understand where I need to do this.


The filter module nested in the token module seems like a good  
candidate. What functions of the lexer or filter are accessed when a  
string keyword (e.g. "delay") is found in the camlp4 grammar?


Thanks, Joel

---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: Re : Re : [Caml-list] Re: camlp4 stream parser syntax

2009-03-08 Thread Joel Reymont
I would prefer to use the #2 approach but I'm using a custom lexer  
built by ocamllex.


Where would I plug in String.lowercase con = ... in Matthieu's lexer,  
for example?


Thanks, Joel

On Mar 8, 2009, at 9:37 AM, Daniel de Rauglaudre wrote:

2/ Use the field "tok_match" of the interface with the lexer.  
Redefining
  it allows you to match some token pattern with the corresponding  
token.

See doc (camlp5) in:
  http://pauillac.inria.fr/~ddr/camlp5/doc/htmlc/ 
grammars.html#b:The-lexer-record
  In the example "default_match", change the test "if con = p_con"  
into

  "if String.lowercase con = p_con".


---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] HLVM is now garbage collected!

2009-03-08 Thread Joel Reymont


On Mar 8, 2009, at 2:45 AM, Jon Harrop wrote:


The OCaml Forge has kindly accepted to host the HLVM project:

 http://hlvm.forge.ocamlcore.org



Am I the only one who VASTLY prefers the clean, uncluttered and easy  
to use GitHub interface to the *Forge one?


---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: Re : Re : [Caml-list] Re: camlp4 stream parser syntax

2009-03-08 Thread Joel Reymont


On Mar 8, 2009, at 1:08 AM, Matthieu Wipliez wrote:


   actionDelay: [ [ "delay"; expression ->
   Asthelper.failwith (convert_loc _loc)
   "RVC-CAL does not permit the use of delay." ] ];


Which of the following tokens does "delay" get checked against?

I'm assuming that camlp4 has to give "delay" to the lexer somehow and  
ask the lexer if the next token matches "delay".


How does this happen?



type token =
   | KEYWORD of string
   | SYMBOL  of string
   | IDENT   of string
   | INT of int * string
   | FLOAT   of float * string
   | CHARof char * string
   | STRING  of string * string
   | EOI



Thanks, Joel

---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: Re : Re : [Caml-list] Re: camlp4 stream parser syntax

2009-03-08 Thread Joel Reymont

How can I make camlp4 parsing case-insensitive?

The only approach I can think of so far is to build a really larger  
set of tokens and use them instead of strings in the parser.


Any flag I can flip or way to do this without a large set of tokens?

Thanks, Joel

On Mar 8, 2009, at 1:08 AM, Matthieu Wipliez wrote:




Is the camlp4 grammar parser case-insensitive?

Will both Delay and delay be accepted in the actionDelay rule?

   actionDelay: [ [ "delay"; expression ->
   Asthelper.failwith (convert_loc _loc)
   "RVC-CAL does not permit the use of delay." ] ];


No, only "delay" is accepted.




---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: Re : [Caml-list] Re: camlp4 stream parser syntax

2009-03-07 Thread Joel Reymont

Matthieu,

Is the camlp4 grammar parser case-insensitive?

Will both Delay and delay be accepted in the actionDelay rule?

actionDelay: [ [ "delay"; expression ->
Asthelper.failwith (convert_loc _loc)
"RVC-CAL does not permit the use of delay." ] ];


Also, I noticed that your lexer has a really small token set, i.e.

type token =
| KEYWORD of string
| SYMBOL  of string
| IDENT   of string
| INT of int * string
| FLOAT   of float * string
| CHARof char * string
| STRING  of string * string
| EOI

My custom lexer, on the other hand, has a HUGE token set, e.g.

  type token =
| BUY_TO_COVER
| SELL_SHORT
| AT_ENTRY
| RANGE
| YELLOW
| WHITE
| WHILE
| UNTIL
...

This is partly because I have a very large set of keywords.

Do I correctly understand that I do not need all the keywords since I  
can match them in the camlp4 grammar as strings like "BuyToCover",  
"SellShort", etc.?


Thanks, Joel

---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: Re : [Caml-list] camlp4 stream parser syntax

2009-03-07 Thread Joel Reymont


On Mar 8, 2009, at 12:20 AM, Matthieu Wipliez wrote:

Joel asked me the parser so I gave it to him, but maybe it can be of  
use for others, so here it is.



While we are on this subject... How do you troubleshoot camlp4 rules?

With a stream parser you can invoke individual functions since each is  
a full-blown parser. Can the same be done with camlp4, e.g. individual  
rules invoked?


Can rules be traced to see which ones are being taken?

Thanks, Joel

---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] camlp4 stream parser syntax

2009-03-07 Thread Joel Reymont

Jon,

On Mar 7, 2009, at 11:52 PM, Jon Harrop wrote:

The [< .. >] denote a stream when matching over one using the  
"parser" keyword
and the tick ' denotes a kind of literal to identify a single token  
in the

stream. So:

   | [< 'Kwd "if"; p=parse_expr; 'Kwd "then"; t=parse_expr;
'Kwd "else"; f=parse_expr >] ->


Should I be using camlp4 grammars as Matthieu suggested?

It seems there are are far more and better resources on doing this  
than the stream parsing approach. This includes your OCaml Journal.


Do I loose anything when going with camlp4 grammars and NOT parsing  
into an OCaml AST? Do I gain a lot with grammars over stream parsing?


Thanks, Joel

---
http://tinyco.de
Mac, C++, OCaml

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: Re : [Caml-list] Re: camlp4 stream parser syntax

2009-03-07 Thread Joel Reymont


On Mar 7, 2009, at 11:21 PM, Matthieu Wipliez wrote:


why are you using stream parsers instead of Camlp4 grammars ?


Because I don't know any better? I'm just starting out, really.

I have a parser that I wrote using ocamlyacc and menhir. I finally  
when with dypgen and didn't touch the code for a few months. I then  
tried to simplify the grammar on account of a later type checking pass  
and realized that I cannot troubleshoot it.


I think I can make do with a camlp4 parser and it will vastly simplify  
debugging.



This:
...
could be written as:
expression: [
 [ (i, _) = INT -> Int i
 | (s, _) = STRING -> Str s
 ... ]
];


Doesn't your example assume that I'm using the camlp4 lexer?


expression: [
 [ e1 = SELF; "/"; e2 = SELF ->
   if e2 = Int 0 then
 Loc.raise _loc (Failure "division by zero")
   else
 BinaryOp (e1, Div, e2) ]
];


Where does SELF above come from?

Can I use a token instead of "/" since I return SLASH whenever "/" is  
found by the lexer.


By the way, do you need you own tailor-made lexer? Camlp4 provides  
one that might satisfy your needs.


It has been said that it's not extensible so I wrote my own lexer  
using ocamllex and wrapped it to return (tok, loc) Stream.t.


Otherwise, you can always define your own lexer (I had to do that  
for the project I'm working on, see file attached).


Thanks, I'll study it.



Your parser would then look like

(* functor application *)
module Camlp4Loc = Camlp4.Struct.Loc
module Lexer = Cal_lexer.Make(Camlp4Loc)
module Gram = Camlp4.Struct.Grammar.Static.Make(Lexer)


Is this extending the OCaml grammar or starting with an "empty" one?


(* rule definition *)
let rule = Gram.Entry.mk "rule"


Is this the "start" rule of the parser?

Thanks, Joel

---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] Re: camlp4 stream parser syntax

2009-03-07 Thread Joel Reymont
Where can I read up on the syntax of the following in a camlp4  
stream parser?


 | [<' INT n >] -> Int n

For example, where are [< ... >] described and why is the ' needed  
in between?



To be more precise, I'm using camlp4 to parse a language into a non- 
OCaml AST.


I'm trying to figure out the meaning of [<, >], [[ and ]]

My ocamllex lexer is wrapped to make it look like a stream lexer  
(below) and I'm returning a tuple of (tok, loc) because I don't see  
another way of making token location available to the parser.


Still, I'm how to integrate the reporting of error location into ?? in  
something like this


 | [< 'Token.Kwd '('; e=parse_expr; 'Token.Kwd ')' ?? "expected ')'"  
>] -> e


Would someone kindly shed light on this?

Thanks in advance, Joel

P.S. ocamllex wrapper to return a' Stream.t

{
let from_lexbuf tab lb =
  let next _ =
let tok = token tab lb in
let loc = Loc.of_lexbuf lb in
Some (tok, loc)
  in Stream.from next

let setup_loc lb loc =
  let start_pos = Loc.start_pos loc in
  lb.lex_abs_pos <- start_pos.pos_cnum;
  lb.lex_curr_p  <- start_pos

let from_string loc tab str =
  let lb = Lexing.from_string str in
  setup_loc lb loc;
  from_lexbuf tab lb

}

---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] camlp4 stream parser syntax

2009-03-07 Thread Joel Reymont
Where can I read up on the syntax of the following in a camlp4 stream  
parser?


  | [<' INT n >] -> Int n

For example, where are [< ... >] described and why is the ' needed in  
between?


Thanks, Joel

---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] camlp4 stream parser and reporting error location

2009-03-07 Thread Joel Reymont
Assuming a simple Camlp4 parser that uses a ocamllex lexer wrapped in  
a stream,


let rec parse_primary = parser

  | [< 'INT n >] -> Int n
  | [< 'FLOAT n >] -> Float n
  | [< 'STRING n >] -> Str n
  | [< 'TRUE >] -> Bool true
  | [< 'FALSE >] -> Bool false

  | [< >] -> raise (Stream.Error "unknown token when expecting an  
expression.")


How do I report the error location?

Do I need to pass loc in with every token?

Then what happens in the error case where there's no token available?

Thanks, Joel

---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] building 64bit ocaml from cvs on mac osx leopard

2009-03-06 Thread Joel Reymont

make clean && build/distclean.sh && configure ... && build/fastworld.sh

 builds without an issue, again once emit.mlp is fixed.

On Mar 6, 2009, at 2:22 PM, nicolas.pouillard wrote:


+ boot/ocamlyacc -v ocamldoc/odoc_text_parser.mly
5 shift/reduce conflicts.
+ ./ocamlc.opt -nostdlib -c -g -w Ale -warn-error Ale -I toplevel -pp
'boot/ocamlrun camlp4/boot/camlp4boot.byte' -I camlp4 -I stdlib -I
camlp4/Camlp4Top -I camlp4/build -o camlp4/Camlp4Top/Top.cmo camlp4/
Camlp4Top/Top.ml
File "camlp4/Camlp4Top/Top.ml", line 37, characters 4-26:
Error: Unbound value Toploop.print_location


This last error is rather strange, and I can't reproduce it, maybe  
it's

another strange build state error?

--
Nicolas Pouillard


---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] building 64bit ocaml from cvs on mac osx leopard

2009-03-06 Thread Joel Reymont
I was able to build a 64-bit OCaml after adjusting asmcomp/amd64/ 
emit.mlp and using the regular build process, e.g.


make world
make bootstrap
make opt
make opt.opt

The Camlp4 build issue is still there with fastworld.sh.

Thanks, Joel

---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] building 64bit ocaml from cvs on mac osx leopard

2009-03-06 Thread Joel Reymont


On Mar 5, 2009, at 4:08 PM, Andres Varon wrote:

I don't think that it compiles the way it is now. It seems to me  
that there was a version merge error and asmcomp/amd64/emit.mlp has  
repeated definitions  of emit_call and emit_jump.



Here's the offending part of asmcomp/amd64/emit.mlp.

The two load_symbol_addr are equivalent and the only difference in the  
rest is the Mac OSX check. /More after the code/


let emit_call s =
  if !Clflags.dlcode && not macosx
  then `call{emit_symbol s...@plt`
  else `call{emit_symbol s}`

let emit_jump s =
  if !Clflags.dlcode && not macosx
  then `jmp {emit_symbol s...@plt`
  else `jmp {emit_symbol s}`

let load_symbol_addr s =
  if !Clflags.dlcode
  then `movq{emit_symbol s...@gotpcrel(%rip)`
  else if !pic_code
  then `leaq{emit_symbol s}(%rip)`
  else `movq${emit_symbol s}`


let emit_call s =
  if !Clflags.dlcode
  then `call{emit_symbol s...@plt`
  else `call{emit_symbol s}`

let emit_jump s =
  if !Clflags.dlcode
  then `jmp {emit_symbol s...@plt`
  else `jmp {emit_symbol s}`

let load_symbol_addr s =
  if !Clflags.dlcode
  then `movq{emit_symbol s...@gotpcrel(%rip)`
  else if !pic_code
  then `leaq{emit_symbol s}(%rip)`
  else `movq${emit_symbol s}`

On my system dlcode is true and so is macosx so it should note be  
taking the PLT branch. There's also this ocamlbuild rule for building  
asmcomp/emit.ml from asmcomp/amd64/emit.mlp


let emit_mlp = "asmcomp"/C.arch/(if ccomptype = "msvc" then  
"emit_nt.mlp" else "emit.mlp") in

rule "emit.mlp"
  ~prod:"asmcomp/emit.ml"
  ~deps:[emit_mlp; "tools/cvt_emit.byte"]
  begin fun _ _ ->
Cmd(S[ocamlrun; P"tools/cvt_emit.byte"; Sh "<"; P emit_mlp;
  Sh">"; Px"asmcomp/emit.ml"])
  end;;

I believe the issue is that distclean.sh does not remove ocamlopt in  
the root of the ocaml source distribution. I was able to get past the  
PLT error once I removed ocamlopt from the root of the tree and  
modified asmcomp/amd64/emit.mlp to remove the second set of emit_call  
and emit_jump functions that do not include Mac OSX checks.


I got a different error from fastworld.sh now and it does not seem to  
be related to 64 bits.


+ boot/ocamlyacc -v ocamldoc/odoc_text_parser.mly
5 shift/reduce conflicts.
+ ./ocamlc.opt -nostdlib -c -g -w Ale -warn-error Ale -I toplevel -pp  
'boot/ocamlrun camlp4/boot/camlp4boot.byte' -I camlp4 -I stdlib -I  
camlp4/Camlp4Top -I camlp4/build -o camlp4/Camlp4Top/Top.cmo camlp4/ 
Camlp4Top/Top.ml

File "camlp4/Camlp4Top/Top.ml", line 37, characters 4-26:
Error: Unbound value Toploop.print_location


---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] building 64bit ocaml from cvs on mac osx leopard

2009-03-06 Thread Joel Reymont


On Mar 6, 2009, at 8:17 AM, Nicolas Pouillard wrote:


I recall that moving from one build procedure to another requires
a full clean (make clean ; ./build/distclean.sh).



./build/distclean && ./configure ... && ./build/fastworld.sh

SANITIZE: a total of 749 files that should probably not be in your  
source
  tree has been found. A script shell file "_build/sanitize.sh" is  
being
  created. Check this script and run it to remove unwanted files or  
use other

  options (such as defining hygiene exceptions or using the -no-hygiene
  option).
IMPORTANT: I cannot work with leftover compiled files.

Once ./_build/sanitize.sh is run, the error is the same as when  
running regular make.


./build/fastworld.sh
...
mkdir asmrun
cp -pf /Users/joelr/Work/ocaml/asmrun/libasmrun.a asmrun/libasmrun.a
cp -p asmrun/libasmrun.a stdlib/libasmrun.a
boot/ocamlrun ./ocamlopt -nostdlib -c -nopervasives -I stdlib -o  
stdlib/pervasives.cmx stdlib/pervasives.ml
/var/folders/pc/pcNEaYn32RW2i++8ZQvErU+++TM/-Tmp-/camlasm6081f1.s: 
602:junk `...@plt' after expression
/var/folders/pc/pcNEaYn32RW2i++8ZQvErU+++TM/-Tmp-/camlasm6081f1.s: 
633:junk `...@plt' after expression

...
/var/folders/pc/pcNEaYn32RW2i++8ZQvErU+++TM/-Tmp-/camlasm6081f1.s: 
2432:junk `...@plt' after expression

File "stdlib/pervasives.ml", line 1, characters 0-1:
Error: Assembler error, input left in file /var/folders/pc/ 
pcNEaYn32RW2i++8ZQvErU+++TM/-Tmp-/camlasm6081f1.s

Exit code 2 while executing this command:
  boot/ocamlrun ./ocamlopt -nostdlib -c -nopervasives -I stdlib -o  
stdlib/pervasives.cmx stdlib/pervasives.ml


And the error?

view /var/folders/pc/pcNEaYn32RW2i++8ZQvErU+++TM/-Tmp-/camlasm6081f1.s  
+2432


movq_camlpervasives...@gotpcrel(%rip), %rdi
movq_caml_register_named_va...@gotpcrel(%rip), %rax
call_caml_c_c...@plt



---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] loading all modules of a cma at once

2009-03-05 Thread Joel Reymont


On Mar 5, 2009, at 6:58 PM, Yoann Padioleau wrote:


Joel Reymont  writes:


ocaml seems to require me to individually #load cmo-s, including
dependencies.




I'm sorry for the noise.

The cma was missing the required cmos.

Foot in mouth!


---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] loading all modules of a cma at once

2009-03-05 Thread Joel Reymont
I have a cma that I built and I'm trying to interactively test some  
functions.


ocaml seems to require me to individually #load cmo-s, including  
dependencies.


Is there a way to load all modules of a cma in one fell swoop?

Do I resign to creating .ocamlinit in that particular directory with  
the required #load-s?


Thanks, Joel

---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] building 64bit ocaml from cvs on mac osx leopard

2009-03-05 Thread Joel Reymont

Ashish,

I'm not getting the previous error anymore and my issue is the same as  
yours now.


Reason?

SANITIZE: a total of 749 files that should probably not be in your  
source
  tree has been found. A script shell file "_build/sanitize.sh" is  
being
  created. Check this script and run it to remove unwanted files or  
use other

  options (such as defining hygiene exceptions or using the -no-hygiene
  option).
IMPORTANT: I cannot work with leftover compiled files.
ERROR: Leftover Ocaml compilation files:

On Mar 5, 2009, at 6:12 PM, Ashish Agarwal wrote:

I just did a fresh install and it is working fine for me when I use  
the
normal method. The ocamlbuild method seems to compile fine, but make  
install
gives some error. I checked ocamlbuild's log file and the last line  
says
"Compilation successful", but when I do make install it says "cp:  
ocamlc: No
such file or directory", although I verified that _build/ocamlc does  
exist.

This seems like a different error than yours.


---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] building 64bit ocaml from cvs on mac osx leopard

2009-03-05 Thread Joel Reymont


On Mar 5, 2009, at 4:08 PM, Andres Varon wrote:

I don't think that it compiles the way it is now. It seems to me  
that there was a version merge error and asmcomp/amd64/emit.mlp has  
repeated definitions  of emit_call and emit_jump.



I wonder if the OCaml team will move to git at some point in the future.

GitHub is an excellent free platform for hosting open source projects.

They make no requirements as to the license so the OCaml license  
should be perfectly fine.


---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] Re: ocaml ast to machine at runtime

2009-03-05 Thread Joel Reymont


On Mar 5, 2009, at 3:55 PM, Sylvain Le Gall wrote:

Why not using the LLVM OCaml binding? It is directly shipped with  
LLVM.

So you can write the entire generator in OCaml...



I would love to use LLVM. My concern is the overhead of calling from  
LLVM into OCaml, though. The code I'll be generating will need to make  
use of a library of functions.


I'd prefer to stay in OCaml so this library will need to be wrapped in  
C, if my understanding is correct. This implies manual labor to code  
the wrappers and the runtime overhead to invoke them.


Thanks, Joel

---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] building 64bit ocaml from cvs on mac osx leopard

2009-03-05 Thread Joel Reymont


On Mar 5, 2009, at 3:10 PM, David Allsopp wrote:

Have you tried building the normal way (./configure -cc "gcc -m64"  
&& make
world bootstrap opt opt.opt install)? fastbuild.sh is experimental  
IFAIK



Makes no difference.

make libraryopt
cd stdlib; make allopt
../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g `./Compflags  
pervasives.cmx` -c pervasives.ml
/var/folders/pc/pcNEaYn32RW2i++8ZQvErU+++TM/-Tmp-/camlasm1dfba1.s: 
602:junk `...@plt' after expression
/var/folders/pc/pcNEaYn32RW2i++8ZQvErU+++TM/-Tmp-/camlasm1dfba1.s: 
633:junk `...@plt' after expression

...
File "pervasives.ml", line 1, characters 0-1:
Error: Assembler error, input left in file /var/folders/pc/ 
pcNEaYn32RW2i++8ZQvErU+++TM/-Tmp-/camlasm1dfba1.s

make[2]: *** [pervasives.cmx] Error 2
make[1]: *** [libraryopt] Error 2
make: *** [opt] Error 2

---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] using a camlp4 man filter with my own type

2009-03-05 Thread Joel Reymont

I looked at the Camlp4 filter wiki [1] but still can't figure this out.

+ ocamlfind ocamlc -package 'oUnit, dyp, extlib' -c -I +camlp4 -g -w a  
-pp 'camlp4of -I src -filter map' -I src -o src/easy_type_check.cmo  
src/easy_type_check.ml

File "src/easy_type_check.ml", line 45, characters 10-15:
Error: This expression has no method expr

This used to work fine in 3.10.x and the error points to "match  
super#expr e with" in strip_token_loc below.


Thanks, Joel

---

Here's the code...

open Easy_ast
open Easy_symtab

exception TypeCheck_error of string

let type_check_error s = raise (TypeCheck_error s)

(* Type inference *)

let rec infer_type env = function
  | Int _-> TyInt
  ... etc

(* Remove annotations for unit testing *)

class map = Camlp4MapGenerator.generated;;

let strip_token_loc = object
  inherit map as super
  method expr e =
match super#expr e with
  | TokenPos (a, _) -> a
  | e-> e
end

let strip_stmt x = strip_token_loc#statement x;;

module Camlp4Trash = struct
  INCLUDE "easy_ast.ml";;
end;;

[1] http://brion.inria.fr/gallium/index.php/Camlp4MapGenerator

---
http://tinyco.de
Mac, C++, OCaml



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] building 64bit ocaml from cvs on mac osx leopard

2009-03-05 Thread Joel Reymont

Does it actually work?

./configure -cc "gcc -m64"
./build/fastworld.sh
...
boot/ocamlrun ./ocamlopt -nostdlib -c -nopervasives -I stdlib -o
stdlib/pervasives.cmx stdlib/pervasives.ml
/var/folders/pc/pcNEaYn32RW2i++8ZQvErU+++TM/-Tmp-/camlasmce9dc3.s:
602:junk `...@plt' after expression
...
jmp _camlpervasives__$5e_...@plt
...

What am I doing wrong?

Thanks, Joel

---
http://tinyco.de



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] ocaml ast to machine at runtime

2009-03-05 Thread Joel Reymont
I would like to compile trading systems written in a pascal-like  
programming language to OCaml AST at runtime, convert it to machine  
code and use it from the same running

OCaml program (natdynlink?).

Is it possible to do this without having gcc installed?

The code I'm generating will need to be iterate over an array of
doubles or be called from within the loop on every array element. It
will also use a bunch of helper functions from my existing library.

If I generate the code using LLVM then I'll need to write my helper
functions in C and the only value I get from OCaml would be the
parsing. If I write the helper functions in OCaml then I believe my
loop will be slow as hell due to all the wrapping and unwrapping of
OCaml values.

Any suggestions?

Thanks, Joel

---
http://tinyco.de


___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] embedding ocaml into a windows app: need gcc?

2008-09-27 Thread Joel Reymont
Can I do without gcc if I want to embed the OCaml compiler into a  
commercial Windows app?


Do I need to become part of the OCaml consortium to do this?

Ideally, I would like to generate OCaml code at runtime and compile it  
into something that can be loaded by a runtime of some sort.


Compiling into a DLL would be ideal, is it possible?

Are there are other options?

Thanks in advance, Joel

--
wagerlabs.com





___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] ocamlnet and kernel poll

2008-09-11 Thread Joel Reymont


On Sep 11, 2008, at 4:32 PM, Markus Mottl wrote:


Use bigstrings as buffers and
perform I/O outside of the OCaml-lock if releasing it (depends on
I/O-size) is more efficient.


Are you suggesting using multiple OS threads within a single process?

When exactly do you release the lock and how do you perform IO outside  
of it?


How do you determine whether to release the lock or not?

Thanks, Joel

--
wagerlabs.com





___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] ocamlnet and kernel poll

2008-09-11 Thread Joel Reymont
Suppose I want to build a server that runs on top of ocamlnet and  
handles 10k+ connections.


ocamlnet seems to use select exclusively.

Any suggestions on how to add kernel poll? Is this possible even?

Thanks, Joel

--
wagerlabs.com

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] Re: pervasives.cmi is not a compiled interface (solved)

2008-09-11 Thread Joel Reymont

Fixed by building with build/fastworld.sh

--
wagerlabs.com





___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] pervasives.cmi is not a compiled interface

2008-09-11 Thread Joel Reymont

This must be a simple issue but I can't figure it out.

I built ocaml from source using 'make world.opt'.

I'm using ocamlbuild as my build system.

cat build.sh
#!/bin/sh

ocamlbuild -classic-display $*

./build.sh src/test.byte

/usr/local/bin/ocamlopt.opt -I /usr/local/lib/ocaml/ocamlbuild  
unix.cmxa /usr/local/lib/ocaml/ocamlbuild/ocamlbuildlib.cmxa  
myocamlbuild.ml /usr/local/lib/ocaml/ocamlbuild/ocamlbuild.cmx -o  
myocamlbuild
+ /usr/local/bin/ocamlopt.opt -I /usr/local/lib/ocaml/ocamlbuild  
unix.cmxa /usr/local/lib/ocaml/ocamlbuild/ocamlbuildlib.cmxa  
myocamlbuild.ml /usr/local/lib/ocaml/ocamlbuild/ocamlbuild.cmx -o  
myocamlbuild

/usr/local/lib/ocaml/pervasives.cmi is not a compiled interface
Command exited with code 2.

What am I doing wrong?

Thanks, Joel

--
wagerlabs.com





___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs