dylan changed the topic of #ocaml to: OCaml 3.09.1 available! Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A free book: http://cristal.inria.fr/~remy/cours/appsem/ | Mailing List: http://caml.inria.fr/bin/wilma/caml-list/ | Cookbook: http://pleac.sourceforge.net/
__DL__ has joined #ocaml
mauke has quit [Remote closed the connection]
mauke has joined #ocaml
_DL_ has joined #ocaml
_DL_ has quit [Read error: 104 (Connection reset by peer)]
__DL__ has quit [Read error: 110 (Connection timed out)]
<mikeX> how would I pass a value of type Unix.file_descr to a C primitive?
<mikeX> hhmm, that wasnt the problem :/
<mikeX> first one is linker error output, second is C source and stub
<mikeX> ocaml 3.08.3
<dylan> mikeX: well, you could convert it to an int and pass it that way.
<mikeX> dylan: it's passed as an int (from Is_long output), that doesn't seem to be my problem :(
<dylan> are you doing something like this?
<dylan> let int_of_file_descr fd = (Obj.magic (fd:Unix.file_descr) : int)
<mikeX> nope, I just pass it as a file descriptor, and a C callback reports that it is an int
<dylan> mikeX: you need to use CAMLparam and CAMLreturn, for one.
<mikeX> hmm, I'm confused now
<dylan> caml primitives must declare their parameters ith CAMLparam, their locals with CAMLlocal, and return their values with CAMLreturn
Submarine_ has joined #ocaml
<dylan> mikeX: this might do: http://pastebin.ca/40031
<dylan> I'm not sure if the extra CAMLlocal1(result) is needed, but I don't see as it'd hurt.
mauke has quit [Remote closed the connection]
mauke has joined #ocaml
<mikeX> thanks for the tip dylan, but I still get the same linker erro :(
smimou has quit ["bli"]
<mikeX> here are the ocaml definitions/calls
Submarine has quit [Remote closed the connection]
Skal has quit [Remote closed the connection]
ski has quit [Read error: 110 (Connection timed out)]
ski has joined #ocaml
mauke has quit [Remote closed the connection]
mauke has joined #ocaml
slipstream has joined #ocaml
mauke has quit [Client Quit]
pango__ has joined #ocaml
slipstream-- has quit [Connection timed out]
pango_ has quit [Read error: 145 (Connection timed out)]
neilc has joined #ocaml
<neilc> hmm, why is there no default action for rules in ocamlyacc?
<neilc> bison's default action is $$ = $1
<neilc> which can be convenient syntax sugart
<neilc> "sugar"
ulfdoz has quit [Read error: 60 (Operation timed out)]
<Smerdyakov> neilc, does that action use the value of the first symbol in the rule for the value of the rule?
<neilc> yeah
<Smerdyakov> neilc, that sounds hideous for rules involving multiple symbols.
<neilc> hideous how?
<Smerdyakov> It's arbitrary and it can mask errors.
<Smerdyakov> (Where you meant to type an action but forgot)
<neilc> well, if you prefer you could limit it to rules whose rhs is a single symbol
<neilc> which would make it less arbitrary
<neilc> and as for masking errors, yeah, that is possible
<Smerdyakov> I think I prefer to avoid special cases like that.
<neilc> it hasn't seemed to cause the zillions of people using bison much trouble, fwiw :)
<Smerdyakov> Using bison is a lot harder than using ml-yacc.
<Smerdyakov> It's more excusable to take shortcuts when the underlying language has poor support for abstract syntax trees.
<neilc> yeah, i suppose
<mikeX> it proved to be a name conflict, the fact that I had both crc32.ml and crc32.o (the later coming from the compilation of crc32.c) messed things up :(
Submarine_ has quit [Remote closed the connection]
<mikeX> hmm, binary with ocamlopt 3.09.1 segfaults when trying to reference a variable obtained with copy_int32() from a C program :/
<mikeX> works fine with ocaml 3.08.3 on athlon xp
ski_ has joined #ocaml
ski has quit [Connection timed out]
kryptt has joined #ocaml
translocatedfetu has joined #ocaml
<translocatedfetu> howdy, can anyone suggest a command line interpreter that is more bash/readline-like?
translocatedfetu is now known as sirreality
<sirreality> by command line interpreter, I mean, the mode where I simply run "ocaml" with no arguments and then have a simple programming environment
<mikeX> sirreality: rlwrap
<mikeX> I think there are some more on the hump
mikeX has quit [""zz""]
<dylan> sirreality: ledit?
<dylan> e.g. "ledit ocaml"
<dylan> gives you a readline-like ocaml toplevel
<sirreality> ok awesome
<sirreality> i knew about wrapping it with emacs, but that would require me learning emacs keys :-)
<sirreality> readline-like is good, specially if it supports vi keys
<sirreality> i will look into both of those
kryptt has quit ["Download Gaim: http://gaim.sourceforge.net/"]
Smerdyakov has quit ["Leaving"]
khaladan has joined #ocaml
__DL__ has joined #ocaml
Rovar has joined #ocaml
<Rovar> is there an established async network library for ocaml?
jo_l_apache has joined #ocaml
jo_l_apache has quit ["bye"]
pango__ is now known as pango
khaladan has quit [Read error: 104 (Connection reset by peer)]
Submarine has joined #ocaml
ulfdoz has joined #ocaml
Rovar has quit ["Leaving"]
rillig_ has joined #ocaml
Skal has joined #ocaml
jo_l_apache has joined #ocaml
rillig has quit [Read error: 110 (Connection timed out)]
_JusSx_ has joined #ocaml
jo_l_apache has quit ["leaving"]
smimou has joined #ocaml
jo_l_apache has joined #ocaml
rillig_ is now known as rillig
jo_l_apache has quit [".ei mi cliva .i co'o"]
Schmurtz has joined #ocaml
<Amorphous> pango: do you know about CFGs and if they are in the subset omcamlyacc supports?
pango has quit [Remote closed the connection]
<Amorphous> lol
<zmdkrbou> Amorphous: of course they are
<Amorphous> zmdkrbou: no not all CFGs are in LALR(0) (that is what ocamlyacc supports right?)
<zmdkrbou> if ocamlyacc didn't work on CFGs, then it wouldn't be a *yacc
<Amorphous> i meant a specific CFG i have
<zmdkrbou> mmmk, i would think that ocamlyacc supports LR(k) grammars
<Amorphous> even LR(infinity) :) ?
<Amorphous> zmdkrbou: do you know if A->aB B->b|bB is in LR(0) ?
<zmdkrbou> i think so
pango has joined #ocaml
<zmdkrbou> Amorphous: in fact, it is
<zmdkrbou> it's a very simple grammar
<Amorphous> but somehow i don't get my actual grammer to work with ocamlyacc but another parser that supports any CFG by GLR does work...
<zmdkrbou> Amorphous: what you wrote is abb*
<zmdkrbou> it even works with lex ....
<zmdkrbou> (abbb* excuse me)
__DL__ has quit [Remote closed the connection]
<Amorphous> my actual grammer is a*B+E B:=e(cd|a) E:=Eof
<Amorphous> zmdkrbou: is that in LR(0) ?
<zmdkrbou> of course it is :)
<zmdkrbou> oups
__DL__ has joined #ocaml
<zmdkrbou> scuse me i didn't read
<zmdkrbou> eeeer
<zmdkrbou> Amorphous: you can write this as a*(e(cd|a))+Eof you know
<zmdkrbou> this is a regular expression
<Amorphous> yes
<zmdkrbou> therefore this definitely *is* LR(0)
<zmdkrbou> it's even LL(1) .....
<Amorphous> are all regular expressions in LALR(0) too?
<zmdkrbou> yes
<Submarine> of course
<zmdkrbou> regular expressions are the most basic level of language recognition
<Amorphous> zmdkrbou: fyi this states ocamlcacc only supports LALR(1) not LR(1) http://pllab.kaist.ac.kr/~shoh/ocaml/ocamllex-ocamlyacc/ocamlyacc-tutorial/sec-mysterious-reduce-reduce-conflicts.html
<Amorphous> thx zmdkrbou
* zmdkrbou is disapointed by ocamlyacc
<zmdkrbou> +p
<Submarine> this not a problem in practice
<Submarine> ocamllex + ocamlyacc are sufficient to parse all languages I've come across, except perhaps FORTRAN
<zmdkrbou> nobody uses such complex grammars :)
<Amorphous> c++
<Submarine> except that for C you need some dirty hacks
<Submarine> well, for C/C++ you need to know some dirty tricks
<zmdkrbou> if you need more, the tool made by francois pottier may do the trick
<Submarine> because (drum rolls) C/C++ is not LR(n)
<Submarine> C/C++ has a contextual grammar
<zmdkrbou> eeer
<zmdkrbou> about C, are you sure ?
<Submarine> I am sure.
<zmdkrbou> i don't believe ansi C is not LR(n)
<Submarine> It is not.
<Amorphous> oh and perl is not LR either
<Submarine> one word: typedef
<zmdkrbou> oh
<zmdkrbou> yes
<zmdkrbou> it's written in the K&R :)
* Submarine wrote the original frontend for Astree
vodka-goo has joined #ocaml
<vodka-goo> hi
<vodka-goo> I was wondering about something, and I thought somebody might have had the same problem already
<vodka-goo> I have a script language, which is sort of a mini-ocaml, which functions, partial application, labels and optional labels, and uses ocaml-like syntax
__DL__ has quit [Read error: 104 (Connection reset by peer)]
<vodka-goo> many users won't know ocaml, so I thought it might be nice for them to propose a more conventional syntax, ruby-like for example, at least changing the application (f ~a:va x) into (f(a=va,x))
<vodka-goo> I won't change the type system, it'd still have partial application, and arbitrary order for labeled args
<vodka-goo> the only problem is for the unit.. it's ugly to change f () into f(()), and I can't figure out any safe automatic sugar
<vodka-goo> sorry for the verbosity ;) does anybody has a hint ?
<zmdkrbou> using something else than () for the unit value :)
<vodka-goo> but it'll still look very arbitrary to people ignoring functional languages
<flux__> use void, that ought to be familiar..
<flux__> or maybe have a separate syntax for partial application :-o
<vodka-goo> it's familiar as a type, not a value
<flux__> (it wouldn't resolve all the uses for () though)
<vodka-goo> flux__: that's a possibility, python has a separate syntax, but it's ugly
<zmdkrbou> None as in python ? :)
<vodka-goo> I'm afraid I need to ask the user to put sthg, None or void or whatever..
zigong has joined #ocaml
<TaXules> :(
<Amorphous> ah now i see it one rule in the grammar i have written is right regular where the others are left regular.
<Amorphous> zmdkrbou: any idea how i can write e(cd|a)+ as a left regular CFG? or how i write a*b+e as a right regular?
quamaretto has joined #ocaml
<Amorphous> forget it. i give up about that for today...
Smerdyakov has joined #ocaml
zigong has quit ["using sirc version 2.211+KSIRC/1.3.12"]
vodka-goo has quit [Remote closed the connection]
mikeX has joined #ocaml
<mikeX> the thread module states that it doesn't take advantage of multi-processor machines, does this stand for Hyper-Threading/Dual-Core systems as well?
jo_l_apache has joined #ocaml
vodka-goo has joined #ocaml
<Schmurtz> mikeX, yes
<mikeX> :(
<Schmurtz> ocaml use only one cpu
<Schmurtz> if you need it, you must use different process linked with pipes
<Schmurtz> (processes)
<Schmurtz> (several processes)
<mikeX> i see
<mikeX> thanks
<Submarine> mikeX, Essentially the memory management is not threadsafe.
<Submarine> this precludes everything like hyperthreading, dual core, whatever
<Submarine> Astree uses multiple processes, pipes and sockets.
<zmdkrbou> </ad> :p
<mikeX> heheh
<mikeX> actually I just finished a nasty hack on the md5 digest module, which adds an optional calculation of a crc32 sum, without having to reread the file, so I thought threading the calculations might be an added bonus for some systems
<mikeX> but I don't think separate processes is worth the effort
lispy_ has joined #ocaml
<mellum> wtf would you need crc for if you have md5?
lispy has quit [Read error: 110 (Connection timed out)]
<mikeX> haha, well it's for anime, most fansub groups append the crc32 sum of the file in their releases
<mellum> Clever, that saves 12 bytes per file as compared to md5!
<mikeX> lol
<mellum> At the expense of being trivially fakeable, but hey.
<mikeX> well it's just for corrupt download detection :/
<Smerdyakov> mikeX, are your downloads much smaller than 12 bytes?
<mikeX> nope
lispy has joined #ocaml
lispy_ has quit [Read error: 104 (Connection reset by peer)]
<mikeX> i meant on the filename :/, anyway, I have to have the crc32 sum to verify, but I would like to have md5sums for myself
lispy has quit [Read error: 110 (Connection timed out)]
<flux__> mellum, crc's are perfectly fine for checking if there's been a transmission error
mellum has quit [Read error: 110 (Connection timed out)]
bzzbzz has quit [Read error: 110 (Connection timed out)]
lispy has joined #ocaml
quamaretto has quit ["bye"]
vodka-goo has quit ["Connection reset by by pear"]
jo_l_apache has quit [".ei mi cliva"]
Submarine has quit [Nick collision from services.]
Raziel has joined #ocaml
<pango> mikeX: mldonkey uses C for the hashing thread, mainly to get around that problem
Raziel has quit ["Yo soy goma. Tú eres cola."]
<mikeX> but you get more overhead for portability right?
<pango> Haven't looked in the details how hard it is to implement
Schmurtz has quit ["Dodo !"]
<mikeX> i see :/
jo_l_apache has joined #ocaml
Raziel has joined #ocaml
vodka-goo has joined #ocaml
kral has joined #ocaml
jo_l_apache has quit [".ei mi cliva .i co'o rodo"]
Raziel has left #ocaml []
__DL__ has joined #ocaml
__DL__ has quit ["Bye Bye"]
kral has quit [""In girum imus nocte et consumimur igni.""]
Skal has quit [Remote closed the connection]
_JusSx_ has quit ["leaving"]
vodka-goo has quit ["Connection reset by by pear"]
smimou has quit ["bli"]