mbishop changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab Ocaml 3.10.0 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
seafood_ has joined #ocaml
bluestorm has quit ["Konversation terminated!"]
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
seafood__ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood__ has quit [Connection reset by peer]
seafood_ has joined #ocaml
nashdj has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
seafood__ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood__ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
zmdkrbou has quit [Read error: 110 (Connection timed out)]
dbueno has quit ["This computer has gone to sleep"]
middayc has joined #ocaml
leo037 has quit ["nenuit"]
piggybox has joined #ocaml
seafood_ has joined #ocaml
bzzbzz has joined #ocaml
piggybo1 has quit [Connection timed out]
yminsky_ has joined #ocaml
yminsky_ has quit []
zmdkrbou has joined #ocaml
yminsky_ has joined #ocaml
kmeyer has left #ocaml []
ita has quit [Remote closed the connection]
middayc has quit []
__suri_ has joined #ocaml
yminsky_ has quit []
__suri has quit [Read error: 110 (Connection timed out)]
buluca has quit [Read error: 113 (No route to host)]
buluca has joined #ocaml
zmdkrbou has quit [Read error: 110 (Connection timed out)]
thermoplyae has left #ocaml []
jderque has joined #ocaml
__suri_ has quit [Read error: 110 (Connection timed out)]
__suri has joined #ocaml
AxleLonghorn has joined #ocaml
piggybo1 has joined #ocaml
seafood_ has quit []
mordaunt has joined #ocaml
jonathanv has joined #ocaml
ygrek has joined #ocaml
piggybox has quit [Read error: 110 (Connection timed out)]
jderque has quit [Read error: 113 (No route to host)]
jonafan has quit [Read error: 110 (Connection timed out)]
jderque has joined #ocaml
ygrek has quit [Remote closed the connection]
piggybox has joined #ocaml
seafood has quit [Read error: 113 (No route to host)]
seafood has joined #ocaml
piggybo1 has quit [Read error: 110 (Connection timed out)]
buluca has quit [Read error: 113 (No route to host)]
ttamttam has joined #ocaml
jderque has quit [Read error: 113 (No route to host)]
olleolleolle has joined #ocaml
AxleLonghorn has left #ocaml []
dibblego has quit [Nick collision from services.]
dabblego has joined #ocaml
filp has joined #ocaml
zmdkrbou has joined #ocaml
Associat0r has quit []
olleolleolle has quit []
acatout has quit ["BRB."]
acatout has joined #ocaml
acatout has quit [Client Quit]
asmanur has joined #ocaml
acatout has joined #ocaml
marmottine has joined #ocaml
leo037 has joined #ocaml
Yoric[DT] has joined #ocaml
<Yoric[DT]> hi
hkBst has joined #ocaml
huh has quit [Read error: 104 (Connection reset by peer)]
huh has joined #ocaml
Mr_Awesome has quit ["aunt jemima is the devil!"]
ttamttam has left #ocaml []
ygrek has joined #ocaml
marmottine has quit [Remote closed the connection]
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
seafood_ has quit [Success]
pattern has quit [Remote closed the connection]
filp has quit ["Bye"]
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
filp has joined #ocaml
seafood_ has joined #ocaml
seafood__ has joined #ocaml
buluca has joined #ocaml
seafood__ has quit [Read error: 104 (Connection reset by peer)]
seafood__ has joined #ocaml
seafood_ has quit [Connection timed out]
seafood__ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
acatout has quit [Remote closed the connection]
ttamttam has joined #ocaml
robyonrails has joined #ocaml
buluca has quit [Read error: 113 (No route to host)]
sergez has joined #ocaml
seafood_ has quit [Read error: 110 (Connection timed out)]
sergez has quit [Read error: 104 (Connection reset by peer)]
sergez has joined #ocaml
piggybox has quit [Read error: 104 (Connection reset by peer)]
sergez has quit []
sergez has joined #ocaml
sergez has quit [Client Quit]
sergez has joined #ocaml
acatout has joined #ocaml
sergez has quit [Read error: 104 (Connection reset by peer)]
sergez has joined #ocaml
dramsay has joined #ocaml
huh has quit [Nick collision from services.]
huh_ has joined #ocaml
sergez has quit []
jonathanv has quit [Read error: 110 (Connection timed out)]
ita has joined #ocaml
jonathan has joined #ocaml
Boojum has joined #ocaml
Boojum is now known as Snark
buluca has joined #ocaml
lmbdwr has joined #ocaml
<lmbdwr> hello
piggybox has joined #ocaml
<Yoric[DT]> hi
RobertFischer has joined #ocaml
Tetsuo has joined #ocaml
leo037 has quit ["Leaving"]
jonathan is now known as jonafan
ygrek has quit [Remote closed the connection]
leo037 has joined #ocaml
ygrek has joined #ocaml
buluca has quit [No route to host]
lmbdwr has quit ["Leaving"]
pango_ has quit [Remote closed the connection]
hkBst has quit [Remote closed the connection]
pango_ has joined #ocaml
piggybox has left #ocaml []
robyonrails has quit ["Sto andando via"]
buluca has joined #ocaml
mordaunt has quit [Read error: 104 (Connection reset by peer)]
marmottine has joined #ocaml
Associat0r has joined #ocaml
zmdkrbou has quit [Read error: 110 (Connection timed out)]
filp has quit ["Bye"]
pattern has joined #ocaml
acatout has quit ["leaving"]
acatout has joined #ocaml
postalchris has joined #ocaml
hkBst has joined #ocaml
asmanur has quit [Remote closed the connection]
hkBst_ has joined #ocaml
nashdj has quit [Read error: 110 (Connection timed out)]
asmanur has joined #ocaml
dbueno has joined #ocaml
hkBst has quit [Read error: 110 (Connection timed out)]
dbueno has quit ["This computer has gone to sleep"]
dbueno has joined #ocaml
middayc has joined #ocaml
ita has quit ["Hasta luego!"]
ygrek has quit [Remote closed the connection]
ygrek has joined #ocaml
RobertFischer has left #ocaml []
postalchri1 has joined #ocaml
postalchris has quit [Read error: 110 (Connection timed out)]
drams has joined #ocaml
jderque has joined #ocaml
dramsay has quit [Read error: 110 (Connection timed out)]
postalchri1 has quit [Remote closed the connection]
bluestorm has joined #ocaml
postalchris has joined #ocaml
rwmjones has quit ["Closed connection"]
leo037 has quit [Connection timed out]
leo037 has joined #ocaml
dramsay__ has joined #ocaml
Snark has quit ["Quitte"]
drams has quit [Read error: 110 (Connection timed out)]
zmdkrbou has joined #ocaml
asmanur has quit [Remote closed the connection]
dramsay__ has quit [Read error: 110 (Connection timed out)]
ttamttam has quit ["Leaving."]
ttamttam has joined #ocaml
ttamttam has left #ocaml []
dbueno has quit ["This computer has gone to sleep"]
<bla> Hm.. what would you propose to parse simple expressions? I need to parse ansi colors and some ansi commands.
<bla> e.g. "<esc>]" int ';' int 'm'
<bla> I was trying with Lexgen + parser, but that lexer is...hm. Poor.
<bla> Now I'm fighting with EXTEND..END, Plexer etc. But i can't understand it with mine materials.
<bla> It either prints nothing or Fatal error: exception Stdpp.Exc_located(_, _)
<bluestorm> hm
<bla> I know how to use ocamllex and ocamlyacc, but they are TOO BIG for this task.
<bla> Lexgen couldn't split "123abc123" into 2 ints, it splitted it into int, and Ident 'abc123'.
<bluestorm> what's the problem with genlex ?
<bluestorm> hm
<bla> Maybe I did something wrong.
<bluestorm> that follows the ocaml naming conventions
buluca has quit [Read error: 110 (Connection timed out)]
<bluestorm> isn't the "foo2" indent allowed in your language ?
<bla> If you know some good materials about camlp4 (EXTEND...) and Plexer (I'm using INT e.g. but haven't seen it's definition and dedcription)
<bla> Hm. I've got stream of characters. If I receive <esc> I have to match either ]int;intm or ]intm or ]int;intg
<bla> All else characters can be passed as 'Char b' further, but it would be cool to lex numbers at the same time.
<bluestorm> the simplest thing to do would probably to code a recursive-descent lexer+parser (in one go) yourself
<bluestorm> using streams, that's quite easy
<bla> I guess If I write a lexer myself existing parser should do
<bla> I can try this way.
<bluestorm> do you really need one ?
<bla> Well, it's one problem only. In this problem I'll have to use more parsers.
<bla> I'll use ocamlyacc/lex for few big parsing problems, but still it would be useful to have something universal for simple parsing problems.
<bluestorm> hum
<bluestorm> once you have a generic lexer (you can plug your lexer into the Genlex interface for reusability), what is more universal than "do the recursive-descent yourself easily with streams" ?
<bluestorm> looks like a very good genericty/usefulness balance
<bluestorm> hm
<bla> It'll be ok. I'll just split lexer and parser, won't do it in one go so I can reuse lexer in other parsers.
<bluestorm> you may want to use a combinatoric parser library
<bluestorm> (for small-scale but with a bit more tools that the manual recursive descent)
<bluestorm> i know one has been developped for OCaml recently (Jane Street's summer of code), but they're not so common i'm afraid
<bla> Hm.
<bla> I'll start with reading more about Stream module.
<bluestorm> (seems most people use a "heavier" external tool solution)
<bla> And then choose some way.
<bluestorm> bla : you can get some examples of streams use for parsing here : http://caml.inria.fr/pub/docs/oreilly-book/html/book-ora106.html#toc138
<bla> Thanks bluestorm
dramsay has joined #ocaml
ygrek has quit ["Leaving"]
dramsay has quit ["Leaving"]
jderque has quit [Read error: 113 (No route to host)]
Amorphous has joined #ocaml
Anarchos has joined #ocaml
buluca has joined #ocaml
<bla> bluestorm, finally I'm writting own parser+lexer. With help of sscanf it will take few minutes.
<bla> In the future I'll try to /aggravate/ problems into bigger ones and solve them all-at-once with yacc/lex
<bla> (accomodate?)
<bluestorm> hm
<bla> aggregate!
<Anarchos> i am making a JVM in ocaml, has it ever been done ?
<bluestorm> Anarchos: hm
<bluestorm> not sure
<Anarchos> ok
<bluestorm> there is an Ocaml-Java project
<jlouis> Anarchos: what does google say to that question?
<Anarchos> now i understand the class file format ;)
<Anarchos> not tried googling for now
<bluestorm> there are some libraries for class file manipulations around
<bluestorm> bla: i'm a little dubitative about the use of sscanf
<bluestorm> maybe i haven't tried hard enough but i think error handling with scanf is quite painful
<bla> Just to parse number.
<bluestorm> hm
<bla> True, I'll have to write try/with clause.
<bluestorm> won't a simple lexer on char Stream.t do the job ?
<flux> ocaml-java, jvm written in ocaml.. the circle would be closed ;)
<bla> bluestorm, for sure it would.
<flux> I suppose things like JIT would be very difficult to implement in an ocaml jvm
<bla> bluestorm, but it's still some fighting for me. ;)
<Anarchos> flux i am only taking source in the official Sun book, which seems 'a bit' outdated ...
<bluestorm> let rec parse_int = parser [< '('0' ..'9' as num); s >] -> (int_of_char num - int_of_char '0') + 10 * parse_int s | [< >] -> 0
<flux> atleast before the llvm-generated code starts working nicely with ocaml..
<flux> maybe meta ocaml brings some options to that?
<bluestorm> (haven't tested the code of course)
<flux> hm, I suppose it doesn't still doesn't do actual runtime compilation, does it?
<bla> bluestorm, seems to be as easy as possible...
<Anarchos> flux JIT , what is it ?
hkBst_ has quit ["Konversation terminated!"]
<flux> anarchos, Just In Time compilation, the most well known technique for making virtual machines fly..
<flux> (and approach native speeds)
<bluestorm> btw there has been an OCamlJIT try
<bluestorm> wich wy rather successful as it seems
<bluestorm> (performances halfway between native and bytecode)
<bluestorm> not sure the project used OCaml itself, though (as it was based on GNU lightning...)
<Anarchos> I don't unterstand why i would need to know about on the fly compilation : i just want to take bytecode and execute it
<bluestorm> on the fly bytecode-tuning is a common task for efficient virtual machines
<bla> bluestorm, hm. I'd like to know this parsing method. I'll try this.
<flux> anarchos, that's a perfectly fine goal :)
<Anarchos> bluestorm ok i see, but i just want to *execute* java code, not to *optimize* it ;)
<bluestorm> have fun
<flux> anarchos, and even without optimizations, it could serve as a base for for example java debuggers
<flux> I'm thinking debugging is what you'll be doing lots when writing that bytecode interpreter :)
<mbishop> BTW I got an answer from the guy at plnews
<bla> bluestorm, guess i should update my ocaml bookmarks. Thanks once again.
<flux> (of course, perhaps I'm wrong and it goes without a hitch)
<mbishop> he says up until about a month ago his site used python cgi, now it uses Ocaml to generate a static page
<flux> self-written all the way?
<flux> I suppose plnews isn't that complex a website, though..
<mbishop> I don't know, he said if he gets time he'd write up something more detailed
* jlouis hacks Twelf
<Anarchos> bluestorm thx a lot !! BTW i knew those pages on DA-OCAML for streams, and i use a stream analyzer to get class file bytes by bytes
<bluestorm> bla : one last thing : the stream syntax ( [< .. >] ) is now a camlp4 extension
<bluestorm> to use it in your caml programs you have to preprocess with camlp4o
<bluestorm> ocamlc -pp camlp4o ...
<bla> I do.
<bluestorm> ok
<bluestorm> fine
<bla> Sure; I was trying this EXTEND thing and so it had to be included.
ita has joined #ocaml
seafood_ has joined #ocaml
seafood_ has quit [Remote closed the connection]
seafood_ has joined #ocaml
pippijn_ has joined #ocaml
pippijn has quit [Read error: 113 (No route to host)]
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
l_a_m has quit [Remote closed the connection]
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
seafood_ has quit [Remote closed the connection]
seafood_ has joined #ocaml
marmottine has quit ["Quitte"]
postalchris has quit [Read error: 110 (Connection timed out)]
seafood_ has quit [Remote closed the connection]
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
<bla> bluestorm, I've reversed reading this int and it works generally.
seafood_ has quit [Read error: 104 (Connection reset by peer)]
<bla> Still. I've got dumb problem. I don't know how to match an escape.
<bluestorm> \n \t ?
<bluestorm> hm
<bla> There's no \e in OCaml, is it?
<bla> char_of_int 27 won't work in matching.
<bla> And let escape = char_of_int 27 and using 'escape won't do either.
<bluestorm> \27 ?
<bla> Ok, trying.
seafood_ has joined #ocaml
<bluestorm> hm
<bluestorm> doesn't work
<bluestorm> \x27 maybe
<bla> Red.
<bla> \x and hex..
<bla> \x1b
<bla> Trying...
<bluestorm> \027 works too
<bla> Works. ;) Thanks.
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
nashdj has joined #ocaml
maayhem has joined #ocaml
<maayhem> good evening
<Anarchos> maayhem hello
<maayhem> let code = (List.map (fst (translate_program indices)) (rev elist)) in [...]
<maayhem> translate_program returns a couple, elist is a list
<maayhem> the first elem of the couple is itself a list, as such code is a list of lists
<Anarchos> so fst () is an element of your couple, not a fun
<maayhem> how can I use List.map to execute translate_program on all elist element, but only care about the first couple element ? currently as you noticed its not well typed
<maayhem> (I want code to be a list of lists and not a list of couples of (list,_))
<maayhem> I see no solution except create a new recursive function instead of using List.map ..
<Anarchos> let code = map (fun (x,y) -> translate x) elists
leo037 has quit ["recherche Google sur le wiki et identification persistante, encore une wiktoire !"]
Tetsuo has quit ["Leaving"]
Yoric[DT] has quit ["Ex-Chat"]
<bluestorm> maayhem: List.map (translate_program indices) (List.map fst (rev elist)) ?
<bluestorm> if you've defined a function composition you could use it
<maayhem> bluestorm, elist is not a list of couple, just the return of translate_program is
<maayhem> Anarchos, I dont understand how this line of code can do what I want
<bluestorm> hm
<bluestorm> so translate_program returns a list of couple of functions ?
<maayhem> it returns a list of couple of something
<maayhem> but in that precise case I just care about the first element of each couple of the list
<pango_> List.map (fun e -> fst (translate_program indices x)) (rev elist) ?
<bluestorm> hmm
<pango_> mmh s/x/e/
<ita> hmm
<bluestorm> List.map fst (List.map (translate_program indices) (rev elist)) ?
<bluestorm> the difficult part is understanding what you want :D
<bluestorm> giving some types would ease things a bit
seafood_ has quit [Read error: 110 (Connection timed out)]
<bluestorm> ('a -> ('b * 'c)) is easier to understand than "function that return a list of couples"
<bluestorm> (and the typing add some informations about what types are equal)
<pango_> maayhem: you didn't mention the type of translate_program (specifically, the expected parameters)