Yurik changed the topic of #ocaml to: http://icfpcontest.cse.ogi.edu/ -- OCaml wins | http://www.ocaml.org/ | http://caml.inria.fr/oreilly-book/ | http://icfp2002.cs.brown.edu/ | SWIG now supports OCaml| Early releases of OCamlBDB and OCamlGettext are available
Yurik has joined #ocaml
<Yurik> re
<whee> hola
<Yurik> whee: hi
Kinners has joined #ocaml
<Yurik> Kinners: hi
<Kinners> hi Yurik
Yurik has quit ["÷ÙÛÅÌ ÉÚ XChat"]
Zadeh has joined #ocaml
Zadeh_ has quit [Read error: 104 (Connection reset by peer)]
emu has quit [Read error: 104 (Connection reset by peer)]
emu has joined #ocaml
mattam_ has quit [No route to host]
gene9 has joined #ocaml
gene9 has quit [Client Quit]
mrvn has joined #ocaml
<mrvn> moin.
<mrvn> anyone awake?
<mrvn> I'm looking for a simple example or tutorial on how to use ocamls parser features.
<whee> mvrn: which in particular?
<whee> derf I can't type, heh
<mrvn> There is some internal parser instead of the lex/yacc generated ones, right?
<whee> well there are streams,
<whee> and genlex I guess
<mrvn> Ahh, yes. That helps already.
<mrvn> How do I make a parser for Genlex?
<mrvn> ocaml-doc/docs/ocaml.html/libref/Genlex.html gives an example but that gives a Syntax error:
<mrvn> let parse_expr = parser _[<_ 'Int n >] -> n
<mrvn> __ denoting the error.
<whee> I think you use streams for genlex, but I'm not sure
<mrvn> # let lexer = Genlex.make_lexer ["+";"-";"*";"/";"("; ")"]
<mrvn> ;;
<mrvn> val lexer : char Stream.t -> Genlex.token Stream.t = <fun>
<mrvn> I have that from the dos.
<mrvn> docs even.
<whee> I'm entirely not familiar with genlex though, I've always used ocamllex/yacc :\
<whee> I've dabbled with streams and camlp4 but that's about it
<mrvn> [< is a keyword so why does it give me an error?
<whee> did you run that through camlp4?
<whee> the stream syntax is handled with camlp4
<mrvn> no. I just pasted it into the ocaml shell out of the blue.
<whee> try #load "camlp4o.cma";; first
<mrvn> Unbound constructor Int
<mrvn> Now thats understandable.
<whee> streams are great
<whee> I found it was easiest to learn how streams work by writing language extensions in camlp4
<mrvn> Ok, now how do I make a char stream to begin with... *blaetter*
<whee> check the Stream module
<whee> or maybe it was Streams
<whee> one of those :)
<mrvn> let char_stream = Stream.of_list ['1'; '+'; '2'];;
<mrvn> let token_stream = lexer char_stream;;
<mrvn> # parse_expr token_stream;;
<mrvn> - : int = 1
<mrvn> Somehow I don#t believe 1+2 is 1
<whee> heh
<mrvn> The docs are frelled. The parser cannot handle the given example becuase the grammar isn't a LL(0) grammar.
<mrvn> I think i will keep using lex and yacc.
<whee> that's probably easiest
lament has joined #ocaml
<dash> hey, can anybody point me at stuff for building .so libs with ocaml linked statically?
<dash> i want to be able to distribute libraries to machines that dont have an ocaml compiler.
<dash> but i haven't found the docs for ocamlc compiler options yet
<whee> I think the -custom flag to ocamlc uses static linking
<whee> gah, once again I wish the String module had functions much like List
<Kinners> yeah I wondered about that
<whee> I don't know what I should do, heh
<Kinners> it has an internal map function, would be nice to have it exported
<whee> I'm thinking of reimplementing strings myself much like haskell and erlang and other languages do, as lists of characters
<whee> can't be that hard, right? :)
<whee> little camlp4 magic to get "blah" into a list of characters, rewrite the String model in terms of that
<whee> module, even
<whee> sounds like a project, anyway. perhaps just add quick syntax extensions to make it easier to use lists of characters
<mrvn> strings are more like char arrays
<whee> yes, and I don't like that :\
<mrvn> But thats what they are.
<whee> it may be faster, but there's not much you can do with it given the current state of the String module
<whee> without writing some of your own functions which really should exist already
<mrvn> strings should have the same functions as array.
<mrvn> like iter and iteri and such
<whee> depends on what you're used to, I guess
<whee> it's just more of a functional style to represent them as lists
<mrvn> Takes way more memory and time.
<whee> perhaps, but it's more flexible
<mrvn> Like 16 times as much memory.
<mrvn> And you need zthe string length a lot of times, which realy sucks in C which has more list like strings.
<mrvn> There should be an iteri and list_of_string function.
<whee> yes, that would be nice
<whee> I'd be content with String module functions for going between lists and strings easily
<Kinners> what stops ocaml from having natively compiled, runtime loadable shared objects? (typing and PIC?)
<dash> hmm, i thought it did
skylan has quit ["Reconnecting"]
skylan has joined #ocaml
<mrvn> whee: let string_of_list = fun char_list -> String.concat "" (List.map (String.make 1) char_list)
<mrvn> whee: But how do you go the other way?
<whee> recursively with an accumulator would be easiest
<mrvn> You would have to count the position in the string your at.
<whee> that's what the accum would do
<mrvn> let rec loop pos string = (string.get pos) :: (loop (pos + 1) string) basically.
<whee> it'd be more of an index, heh
* whee hates for loops
<mrvn> Strings realy should be a variant of char arrays, with the to_list, of_list, iteri, map, fold_* functions.
<Kinners> dash: I thought there was a limitation where you couldn't have a dlopen type function for native code
<whee> strings just need to be easier to work with with the standard module library
<whee> these things should be included :P
<mrvn> How does that work with dlopen anyway?
<mrvn> Programs that use the dynlink library simply need to link dynlink.cma with their object files and other libraries. Dynamic linking is available only to bytecode programs compiled with ocamlc, not to native-code programs compiled with ocamlopt.
<mrvn> Anything I missed?
lament has quit ["<Liam> cocks || <Liam> gigantic cocks || <Liam> slapping me in the face"]
gene9 has joined #ocaml
gene9 has quit [Client Quit]
Kinners has left #ocaml []
lament has joined #ocaml
karryall has quit [Read error: 104 (Connection reset by peer)]
mattam has joined #ocaml
rox is now known as rox|deminished
Zadeh_ has joined #ocaml
Zadeh has quit [Read error: 54 (Connection reset by peer)]
TachYon26 has joined #ocaml
docelic is now known as docelic|away
systems has joined #ocaml
systems has quit ["Client Exiting"]
foxen5 has quit [Read error: 104 (Connection reset by peer)]
karryall has joined #ocaml
TachYon26 has quit ["bez ki³y nie ma zaliczenia (z prawd studentek AM)"]
Yurik has joined #ocaml
<Yurik> re
Yurik has quit [Read error: 104 (Connection reset by peer)]
esabb has joined #ocaml
Yurik has joined #ocaml
<Yurik> re
mattam_ has joined #ocaml
lament has quit ["<Liam> cocks || <Liam> gigantic cocks || <Liam> slapping me in the face"]
Yurik has quit [Read error: 104 (Connection reset by peer)]
foxen5 has joined #ocaml
mrvn_ has joined #ocaml
mattam has quit [Read error: 110 (Connection timed out)]
mrvn has quit [Read error: 110 (Connection timed out)]
cmo has joined #ocaml
cmo has left #ocaml []
whee has quit [Read error: 110 (Connection timed out)]
Yurik has joined #ocaml
<Yurik> re
TachYon26 has joined #ocaml
Yurik has quit [Read error: 104 (Connection reset by peer)]
Dalroth has joined #ocaml
Yurik has joined #ocaml
Yurik has quit ["÷ÙÛÅÌ ÉÚ XChat"]
Yurik has joined #ocaml
Yurik has quit [Read error: 104 (Connection reset by peer)]
TachYon26 has quit ["bez ki³y nie ma zaliczenia (z prawd studentek AM)"]
lam has quit [Read error: 104 (Connection reset by peer)]
whee has joined #ocaml
lam has joined #ocaml
lam has left #ocaml []
lam has joined #ocaml
skylan has quit [Read error: 104 (Connection reset by peer)]
skylan has joined #ocaml
asquii has joined #ocaml
asqui has quit [Read error: 104 (Connection reset by peer)]
asquii is now known as asqui
asquii has joined #ocaml
asqui has quit [Connection timed out]
asquii is now known as asqui
TimFreeman has joined #ocaml
<TimFreeman> I'm seeing a bug where OCAML is running static initializers for a module more than once. Any rumors of recent fixes?
<whee> TimFreeman: have a short example that produces the bug?
<TimFreeman> Not yet. I'm working on it.
<whee> I'll test it on the most recent CVS build if you'd like
<TimFreeman> That will be good. Let ya know in an hour or so.
lament has joined #ocaml
docelic|away is now known as docelic
docelic is now known as awa
awa is now known as docelic|away
systems has joined #ocaml
Dalroth has quit [Remote closed the connection]
mattam_ has quit ["zZz"]
<systems> any news?
systems has quit [Read error: 110 (Connection timed out)]
lindril has joined #ocaml