flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.0 out now! Get yours from http://caml.inria.fr/ocaml/release.html
sporkmonger has joined #ocaml
Alpounet has quit ["Quitte"]
jeddhaberstro has joined #ocaml
slash_ has quit [Client Quit]
Lomono has quit ["Don't even think about saying Candlejack or else you wi"]
travisbrady_ has quit []
alexyk has joined #ocaml
jeddhaberstro has quit []
ched_ has joined #ocaml
Ched has quit [Read error: 110 (Connection timed out)]
jeddhaberstro has joined #ocaml
ulfdoz_ has joined #ocaml
ulfdoz has quit [Read error: 110 (Connection timed out)]
ulfdoz_ is now known as ulfdoz
eevar_ has joined #ocaml
Lomono has joined #ocaml
mfp has quit [Read error: 110 (Connection timed out)]
mfp_ has joined #ocaml
eevar has quit [Read error: 110 (Connection timed out)]
sgnb has quit [Read error: 104 (Connection reset by peer)]
sgnb has joined #ocaml
sgnb has quit [Remote closed the connection]
sgnb has joined #ocaml
jeddhaberstro has quit []
willb has joined #ocaml
travisbrady has joined #ocaml
willb has quit [Client Quit]
ulfdoz_ has joined #ocaml
ulfdoz has quit [Read error: 101 (Network is unreachable)]
ulfdoz_ is now known as ulfdoz
julm has quit [Read error: 60 (Operation timed out)]
julm has joined #ocaml
Lomono has quit ["Don't even think about saying Candlejack or else you wi"]
alexyk has quit []
alexyk has joined #ocaml
flux has quit [Read error: 60 (Operation timed out)]
flux has joined #ocaml
duper-_ has left #ocaml []
Camarade_Tux has joined #ocaml
julm has quit [Read error: 110 (Connection timed out)]
julm has joined #ocaml
sporkmonger has quit []
alexyk has quit []
eevar has joined #ocaml
Camarade_Tux has quit ["Leaving"]
<travisbrady> can anyone tell me what I'm not understanding about optional args here? http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5763#a5763
<travisbrady> i would think this would work just fine, but i'm getting a type error
<mrvn> which one is line 96?
eevar_ has quit [Read error: 110 (Connection timed out)]
<travisbrady> ahh, found it "every function call for a function with optional arguments is required to end with a positional argument" from: http://sds.podval.org/ocaml-sucks.html
<travisbrady> coming from a Python background that seems weird since all optional args always come last
jamii has joined #ocaml
<flux> travisbrady, if you think about it, you may find out why ocaml has that behavior :)
<palomer> why is it again?
<flux> let foo ?a ?b = print_string "hello" in foo ~a:42
<flux> should that print hello?
<flux> how about .. let p = foo ~a in p ~b:42?
<flux> (~a:42 of course)
<palomer> so we can't give a sensical operational semantics?
<flux> well, the current semantics is sensical
<flux> you just need to put in all the arguments until it evaluates, up to that you have partially applied function
<flux> or, you need to put in one of the non-optional non-labeled ones
<palomer> hrmph
<palomer> well
<palomer> off to bed
<palomer> night!
<flux> actually the simplest case would be: let foo ?a = 42 -- how to call foo without giving it a?
<flux> plain 'foo' means the function, not calling it
<flux> and no type casting can make that into a function that would have a unit parameter that would make it callable
<mrvn> unit parameters on the other hand waste registers.
<flux> too bad, because in non-polymorphic case there's no need?
<flux> I suppose the register should be free for the compiler once the call has been made, though?
<mrvn> flux: I Understand that let f x = x : 'a -> 'a needs to pass unit through.
<flux> (because nothing depends on it)
<mrvn> But let f () = ... should totaly skip it.
<flux> it could break the C interface, though
<flux> these kind of changes are difficult due to that..
<mrvn> flux: map unit to void
<flux> mrvn, well, in current C code it isn't void
<flux> so if it gets mapped to void, what happens?
<mrvn> flux: nothing.
<flux> I suppose not much will be broken, unless you actually refer to the unit parameter in C code
<mrvn> yeah, is unit 0 or 1 in C?
<flux> perhaps there should be a tool or something that would come with the compiler, that would enable making C-breaking changes
<flux> something that could totally revamp parameter passing, for example
<flux> or record structures
<flux> switching to that kind of tool/library would be a breaking change, though :)
<flux> but I'll be moving to the office now, happy optimization :)
<mrvn> If you map unit to void then things like extern foo : int -> unit -> int -> int = "" would break. But would anyone write that?
<mrvn> I think, other than as 'a, unit is only used as last argument.
LeCamarade|Away is now known as LeCamarade
eevar2 has joined #ocaml
rjack has joined #ocaml
ikaros has joined #ocaml
petchema has joined #ocaml
sgnb has quit [Remote closed the connection]
sgnb has joined #ocaml
hkBst has joined #ocaml
zerny has joined #ocaml
Yoric[DT] has joined #ocaml
mfp_ is now known as mfp
LeCamarade has quit ["Gone."]
yziquel has quit [Read error: 110 (Connection timed out)]
julm has quit [Read error: 60 (Operation timed out)]
julm has joined #ocaml
julm has quit [Excess Flood]
julm has joined #ocaml
jeanbon has joined #ocaml
Yoric[DT] has quit [Read error: 110 (Connection timed out)]
jeanbon has quit ["EOF"]
verte has joined #ocaml
Yoric[DT] has joined #ocaml
sgnb has quit [Read error: 104 (Connection reset by peer)]
sgnb has joined #ocaml
Yoric[DT] has quit [Read error: 110 (Connection timed out)]
Spiwack has joined #ocaml
LeCamarade has joined #ocaml
verte has quit ["~~~ Crash in JIT!"]
julm has quit [No route to host]
julm has joined #ocaml
sgnb has quit [Remote closed the connection]
sgnb has joined #ocaml
sgnb has quit [Client Quit]
sgnb has joined #ocaml
mehdid has quit ["leaving"]
sgnb has quit ["leaving"]
sgnb has joined #ocaml
sgnb has quit [Client Quit]
sgnb has joined #ocaml
alexyk has joined #ocaml
mehdid has joined #ocaml
rjack has quit ["leaving"]
Lomono has joined #ocaml
bombshelter13_ has joined #ocaml
alexyk has quit []
rjack has joined #ocaml
willb has joined #ocaml
barismetin has joined #ocaml
<kaustuv> Seen on caml-list: "OCaml: is this still supported by INRIA?"
<kaustuv> Has OCaml *ever* been supported by INRIA?
<flux> if by support you mean providing work power for it, then afaik yes.. if by support you mean responding to issues from people, then no?
<kaustuv> The latter, yes. I guess there is technically a public issue tracker, which is more support than Microsoft provides for F# (unless I'm wrong).
<kaustuv> "What systems can OCaml easily interoperate with?" -- would "Von Neumann computers" be too cheeky a response?
<hcarty> kaustuv: Far too cheeky. "Von Neumann computers with a C compiler or network interface" is much more appropriate.
eevar2 has quit ["This computer has gone to sleep"]
julm has quit [Read error: 60 (Operation timed out)]
<hcarty> kaustuv: What is the current state of your cairo-ocaml modifications?
julm has joined #ocaml
lutter1 has joined #ocaml
lutter has quit [Read error: 113 (No route to host)]
travisbrady has quit []
sporkmonger has joined #ocaml
jamii has quit [Read error: 54 (Connection reset by peer)]
* rwmjones answered ...
nexes has joined #ocaml
<nexes> Hey, has anyone here installed Carafe with the latest ocaml by any chance?
<nexes> I'm trying to figure out why there is no ocamlbuild.cmx file.
nexes has quit ["leaving"]
nexes has joined #ocaml
break has joined #ocaml
kaustuv_ has joined #ocaml
jeanbon has joined #ocaml
travisbrady has joined #ocaml
johnnowak has joined #ocaml
robocop has joined #ocaml
<johnnowak> i'm having a bizarre problem with ocamlopt. i simple want to compile a .ml file (that has an associated .mli file), but it insists the module type is unbound. any ideas?
<johnnowak> the .ml file begins with 'module Foo : FOO = struct' and the .mli file begins with 'module type FOO = sig'. it's complaining that module type FOO is unbound.
<robocop> johnnowak: because, for ocamlopt, the module should be .mlx, no ?
<Spiwack> that's because you should have the definition of the module type in the ML as well
<Spiwack> copy/pasted from the .mli
<johnnowak> right. gah it's been awhile.
<Spiwack> (by ML, I meant .ml, sorry I'm quite tired)
<johnnowak> thanks
<robocop> ha no, sorry.
travisbrady has quit []
alexyk has joined #ocaml
LeCamarade is now known as LeCamarade|Away
<johnnowak> Spiwack: continuing... now having a problem where in 'ocamlopt foo.ml bar.ml', bar.ml cannot reference the module defined in foo.ml
<nexes> Does anyone know why I'm not getting "ocamlbuild.cmx" and "ocamlbuildlib.cmxa" using the standard ocaml install instructions?
<nexes> Or is there some particular option I need to use?
<Spiwack> (why do you need a native ocamlbuild ?)
<Spiwack> johnnowak : I think you're supposed to compile them in order
<nexes> I have no idea. I'm just trying to get a particular app to work, Carafe.
<nexes> And the make won't work without it.
<Spiwack> ocamlopt -c foo.ml && ocamlopt -c bar.ml && ocamlopt foo.cmx bar.cmx
<johnnowak> Spiwack: doesn't work either unfortunately
<Spiwack> nexes : have you build ocaml with make opt.opt?
<nexes> I've tried a few ways, but not sure about that. Let me check..
<Spiwack> johnnowak : maybe they are not in the same directory? then you need to use a -I option.
<johnnowak> Spiwack: indeed they are though.
<Spiwack> damn
<Spiwack> the module defined in Foo.ml is Foo.Foo
<Spiwack> Maybe you wrote Foo.f instead of Foo.Foo.f ?
<johnnowak> .. the file itself is a module?
<Spiwack> absolutely
<johnnowak> gah
<johnnowak> that would explain a lot. thanks.
<kaustuv_> This is *such* a mistake in OCaml. They should have used the SML design.
<johnnowak> aye, this is .. stupid
<johnnowak> for lack of a better descriptor
<kaustuv_> But it might be worth it for signatures as part of modules. It's a toss up.
<Spiwack> I'm not sure why it should be a mistake.
rjack has quit ["leaving"]
<Spiwack> (though I think it uncool that files cannot be functors or module types)
barismetin has quit [Remote closed the connection]
<kaustuv_> The mistake is that the module system works against you if you want to name your signatures.
<Spiwack> Mmm, fairly true
Yoric[DT] has joined #ocaml
<Spiwack> you could write a foo_sig.ml
<Spiwack> where you input your signature
<Spiwack> and then foo.mli would be include Foo_sig.S
<Spiwack> or whatever similar
<Spiwack> But yes
<Spiwack> .mli files should be signatures
<Spiwack> (maybe it should even be more flexible, but there are pros and cons)
<Spiwack> and I really think functors should have been able to be files (but maybe it just doesn't work, then the Great Creator is to blame).
<kaustuv_> It would be easier in ocaml than sml to have files defining functors because ocaml has functor signatures.
<Spiwack> Well, conceptually it doesn't sound any difficult, my wonder is more about the file format, say.
<johnnowak> i've put the signature in the .mli without wrapping it an a sig and the struct in the .ml file without wrapping it in a struct... now it says that the implementation does not match the interface.
<johnnowak> The field `Foo' is required but not provided
<johnnowak> The field `FOO' is required but not provided
<kaustuv_> johnnowak: http://ocaml.pastebin.com
<flux> johnnowak, how do you compile?
<Spiwack> uh
<Spiwack> I think
<Spiwack> you should do rm foo.cmi
<flux> johnnowak, do you compile also the .mli-file, before compiling the .ml-file?
<johnnowak> Spiwack: ah, that did it, thanks
<Spiwack> Good, because I've got to go now.
Spiwack has quit ["Leaving"]
OChameau has quit ["Leaving"]
kaustuv_ has quit ["ERC Version 5.3 (IRC client for Emacs)"]
Camarade_Tux has joined #ocaml
jeff_s_ has joined #ocaml
alexyk has quit []
<palomer> hrmph
<palomer> hrmph, writing a function string -> string option which replaces every occurence of '_' with None is not as easy as I thought
<jeff_s_> ?
<palomer> call the function f
<palomer> then f "foo_foo" is [Some "foo";None;Some "foo"]
<jeff_s_> oh ok, I wondered if that's what you meant (string -> (string option) list)
<palomer> oh, woops
<palomer> right, string -> string option list
<jeff_s_> s'ok :)
jeanbon has quit [Connection timed out]
<palomer> http://pastebin.com/m3d3005bd <--here's my solution
<palomer> I dare someone to beat that!
<julm> palomer, do you only need to replace underscores or do you also want to replace a string in general?
<break> that looks pretty long to me
<palomer> I only need underscores, but general solutions are cooler
* Yoric[DT] feels like rewriting this with a parser combinator :)
<palomer> http://pastebin.com/m511b7a7 <--woops, last solution had a bug, this one should be good
<palomer> Yoric[DT], you'd only need the lexing part
<Yoric[DT]> Sure.
* Yoric[DT] might try later today.
<flux> say, has anyone tried running ocaml on a maemo device?
alexyk has joined #ocaml
<jeff_s_> palomer: yours will be faster if you pull "String.length str" out of the iter function
<jeff_s_> palomer: here's a solution: http://pastebin.com/m32459918
<palomer> that's a cool solution
<jeff_s_> thanks :)
<palomer> wait
<palomer> String.length is O(1)
<palomer> no?
<jeff_s_> Oh, you're probably right. I've been thinking of strings as lists lately.
<palomer> you can shorten the with clause
<palomer> if String.length str - i = 0 then .. else ..
<palomer> well, it would be if String.length str - i = 0 then [] else [Some x]
<palomer> oh wait, nevermind
<palomer> if String.length str - i = 0 then [] else [Some (String.sub str i (String.length str - i))]
<jeff_s_> are you going for smallest code length possible?
<Camarade_Tux> palomer, List.map (function "_" -> None | s -> Some s) (Str.bounded_split "_" mylist) ?
<palomer> nope
<palomer> just discussing different options
<jeff_s_> I just assumed using the Str module was cheating :)
nexes has left #ocaml []
<flux> Str-module is eeevil
<flux> it makes your code thread-unsafe even if it looks safe
<Camarade_Tux> I was sure it wasn't bounded_split, it's full_split, and I forgot to make a regexp out of "_"
<Camarade_Tux> flux, yeah but I know the api, I'm sure pcre has something equivalent
<flux> yes
<Camarade_Tux> flux, btw, I've started to use mikmatch in my code, so I'm dropping Str too ;)
<palomer> err
<palomer> split works too
<palomer> thought it's (function Text s -> s | Delim s -> s)
<Camarade_Tux> split doesn't list the delimiter though
<palomer> why is Str evil?
<Camarade_Tux> palomer, because it's completely safe-unsafe and uses a lot of mutation
<Camarade_Tux> well, not a lot but enough to be annoying
<palomer> safe-unsafe?
<flux> it took a bloody long time to figure out why a certain program sometimes had protocol errors
<flux> it was because it used Str.split from multiple threads
<Camarade_Tux> palomer, s/safe/thread/ ; )
<Camarade_Tux> flux, ouch !
zerny has quit [Remote closed the connection]
<palomer> but if the program is threadless, it's ok, right?
<flux> yes, sure
<flux> until one day you decide to reuse a module from it in a threaded program
<Camarade_Tux> but the api is a bit ugly still
<flux> I don't see why torpedo oneself when you can use Pcre, which is better anyway
<Camarade_Tux> the notion of "last matched string" is just weird
<jeff_s_> it is very strange, I never liked it
<jeff_s_> I have the engine for a polymorphic regex module, just it needs a parser
<flux> jeff_s_, how is it polymorphic?
<flux> parser of regular expressions?
<Yoric[DT]> jeff_s_: have you looked at Batteries' ParserCo?
<Yoric[DT]> (which is also polymorphic)
<jeff_s_> no, but batteries is cool, so I assume ParserCo is too :)
<Yoric[DT]> Thanks :)
<Yoric[DT]> ParserCo is experimental, though.
<Yoric[DT]> It's actually Future.ParserCo.
<jeff_s_> flux - it's not quite a regex engine, my bad, but it can be used that way
<flux> yoric[dt], parserco is akin to the thing haskell people use?
<Yoric[DT]> Yep.
<flux> does Batteries have some Monadic framework in it yet, btw?
<flux> I suppose ParserCo is nice when you have parsing need 'in the small' but still large enough to make regular expression-based parsing uncomfortable
<flux> I'd view myself using parser generators for bigger tasks, still
<Camarade_Tux> palomer, see http://ocaml.pastebin.com/m51ba527
<Camarade_Tux> (for the uglyness of Str)
* jeff_s_ finds parserCo.mli
ikaros has quit [Read error: 110 (Connection timed out)]
psnively has joined #ocaml
<Camarade_Tux> wouldn't it be possible to blacklist thread-unsafe modules when using threads ? should be quite easy to detect one is trying to link against str and threads at the same time
<johnnowak> is it possible to do anything in the event of an allocation failure? would like to attempt cleanup if the runtime fails to get memory from the OS
psnively has left #ocaml []
<flux> camarade_tux, I think this is a suitable context for that piece of source: http://www.icanhasforce.com/2008/03/06/sense-this-picture-makes-none/
<jeff_s_> johnowak - i'm thinking there's an exception like Out_of_memory, not sure though
<jeff_s_> ya it's a predefined exception http://caml.inria.fr/pub/docs/manual-ocaml/manual033.html
<johnnowak> is it possible to do anything in the event of an allocation failure? would like to attempt cleanup if the runtime fails to get memory from the OS.
<flux> johnnowak, if you are running out of system memory (and not just some resource) for example under linux, you will likely not get an exception
<Camarade_Tux> flux, ^^
<flux> johnnowak, it is because the failure occurs when you use the memory, not when you allocate it
<johnnowak> i understand that, but i'm wondering if an exception is actually thrown
<Camarade_Tux> yeah, I deliberately broke the code : I tried with s as a parameter for matched_string and when I saw it was working, I broke everything :)
<jeff_s_> ParserCo looks neat. To catch up with haskell it'll have to have permutation support ><
<Yoric[DT]> Well, don't hesitate to add it :)
Amorphous has quit [Read error: 110 (Connection timed out)]
<Yoric[DT]> Camarade_Tux: what we attempt to do in Batteries is replace thread-unsafe modules with thread-safe ones when using threads.
<Yoric[DT]> But we do strictly nothing against str.
<Yoric[DT]> Come to think about it, we could blacklist Str when using threads.
Amorphous has joined #ocaml
<Yoric[DT]> Would actually be quite easy, as we have two different packages, depending on whether threads are used.
<Camarade_Tux> Yoric[DT], nice :)
<Yoric[DT]> I wonder if it would be a good idea.
<Yoric[DT]> mmmm....
<Yoric[DT]> Probably, yes.
<Camarade_Tux> a warning would be nice
robocop has quit ["Leaving."]
<Camarade_Tux> blacklist, I'm not sure, some people might not like it
<Camarade_Tux> Warning: YOU'RE DOING IT WRONG!
<Yoric[DT]> :)
<Yoric[DT]> A warning sounds difficult.
<Yoric[DT]> Unless it's at runtime.
<Camarade_Tux> well, it could be enough
<Camarade_Tux> compile-time would be better sure
sporkmonger has quit []
<Yoric[DT]> Could you add a Request for Features on this?
<Camarade_Tux> sure (have to work for my exam but I've sticked it to the wall ;) )
<Yoric[DT]> :)
* Yoric[DT] is currently quite busy with MLState stuff :)
<Yoric[DT]> That and trying to understand HM(X).
ched_ has quit [Remote closed the connection]
johnnowak has quit []
Yoric[DT] has quit [Read error: 60 (Operation timed out)]
itewsh has joined #ocaml
travisbrady has joined #ocaml
Associat0r has quit []
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
ice_four has joined #ocaml
Cafuneba has joined #ocaml
Camarade_Tux has quit ["Quitte"]
jeanbon has joined #ocaml
<break> i'm trying the parsing example on http://caml.inria.fr/pub/docs/manual-ocaml/manual026.html and get "Error: Unbound module Parser"
<break> i don't suppose anyone knows of a sample parser for a simple programming language? that is my goal
Yoric[DT] has joined #ocaml
hkBst has quit [Read error: 104 (Connection reset by peer)]
jeddhaberstro has joined #ocaml
<jeff_s_> break - just the parser, not a compiler?
<jeff_s_> break - how are you running the example?
<break> just a parser
<break> i'm running it by copying the code provided into files named as per example and: ocaml < calc.ml
<jeff_s_> do you have a file "parser.mly"?
<break> yes, containg the yacc-like stuff
<break> and lexer.mll with the lex stuff
<break> and a makefile doing the commands given
<jeff_s_> ocamlc does not know about parser.cma, which gives you the error
<jeff_s_> er I mean, ocaml doesn't, when you do ocaml < main.ml
jeanbon has quit ["EOF"]
<jeff_s_> try ocaml lexer.cmo parser.cmo < calc.ml
<jeff_s_> Sorry I'm thikning ahead of myself. time to slow down ><
<break> i don't even get .cmo files
<break> File "lex.mll", line 3, characters 0-11:
<break> Error: Unbound module Parser
<break> on the line: ocamlc -c lexer.ml
<break> works up til there. is Parser not a built-in?
<jeff_s_> that's right it's not built in
<break> i figured it must've been. sigh.
<jeff_s_> you have a grammar file, parser.mly. You compile the grammar to an ocaml module with "ocamlyacc parser.mly", which gives you parser.mli and parser.ml
Ched has joined #ocaml
<break> yup
<jeff_s_> the "parser.cmo" part of "ocamlc -o calc lexer.cmo parser.cmo calc.cmo" gives ocamlc the Parser module
<break> ah
<jeff_s_> if you don't have parser.cmo, that would explain the problem
vbmithr has left #ocaml []
itewsh has quit [Success]
<jeff_s_> or if you didn't give "parser.cmo" as an argument to ocaml/ocamlc, that would also explain it
itewsh has joined #ocaml
<break> if a simple calculator example is this convoluted i can't imagine ever figuring out a real-life solution. thanks for the help.
<jeff_s_> you're welcome. and yes, ocamlyacc is a strange way to learn to write parsers
<jeff_s_> it's a legacy kind of solution to the problem of how to write parsers
<break> can you suggest a more straight-forward way?
<palomer> how do we write parsers nowadays?
<break> i know how to use lex and yacc but am trying to avoid writing this in C
<palomer> what kind of grammar are you dealing with?
<break> that is a straight-forward, simple question but i don't know the correct answer, as i have trouble understanding the differences LL/LR/LALR and all of that
<break> let me see if i can figure that out
<jeff_s_> break - is your grammar very complicated? Writing a parser by hand might not be hard
<break> i am trying to parse C.
<palomer> oh my
<jeff_s_> oh um, ouch. I think haskell already can do that if you don't mind that.
<break> yes i saw the Language.C.GCC thing
<jeff_s_> though I swear someone was already doing a c parser in ocaml...
<break> but haskell seems like line-noise to me
<palomer> http://cristal.inria.fr/~fpottier/menhir/ <--this looks cool
<jeff_s_> menhir is just a fancy yacc I think
<palomer> what (are $ you . talking about) ?
<jeff_s_> $ is just . backwards, and . is function application, not hard at all :P
<palomer> . is composition I thought
<palomer> and $ is for associativity
<jeff_s_> ($) :: (a -> b) -> a -> b
<jeff_s_> ok ya
<break> i've been looking for a solution to parse C in any other languages other than C and the haskell solution is the only decent one i've run across
<jeff_s_> well, I guess it depends if you want to do it from scratch or use someone else's project
<jeff_s_> clang is a c parser n c++, not that that's much of a help?
<break> yeah i saw the llvm thing
<break> for me c++ is worse than c, but perhaps i'm just too idealistic
ikaros has joined #ocaml
willb has quit [Read error: 110 (Connection timed out)]
<jeff_s_> break - I'm not sure what you're trying to do, but if Haskell can print a c parse tree, you could read it into caml with a simpler grammar than it would take to parse all of c, I would think
bombshelter13_ has quit []
<mrvn> jeff_s_: urgs, that would be so ugly.
<break> i suppose, but i was naively trying to keep it simple
itewsh has quit [Success]
<break> the more i program the more i hate it
<break> thanks for your help
itewsh has joined #ocaml
<jeff_s_> np. sorry you aren't enjoying yourself :(
<jeff_s_> Is there a BNF definition for c somewhere?
Yoric[DT] has quit [Read error: 110 (Connection timed out)]
itewsh has quit [Read error: 60 (Operation timed out)]
itewsh has joined #ocaml
<break> yes
<jeff_s_> on a webpage? I didn't find one.
<jeff_s_> I'm curious now how hard of a problem it is
Ched has quit [Remote closed the connection]
<break> it's not rocket science, i'm just going to do it in lex/yacc
<jeff_s_> interesting, ya it's not terribly long
<break> i was hoping to write a static analysis tool, i guess i can write it in C and point it at itself :-/
<jeff_s_> considering you have that langauge definition to work from, I"m suprised ocamlyacc would be that hard. seems like it'd be easier than c in many ways
Ched has joined #ocaml
<break> it's not that it's hard, it's that i can't figure out how to make it work for much simpler examples
<jeff_s_> :(
<break> it's sad when lex and yacc make more sense than alternatives, but maybe it's just me
ikaros has quit ["Leave the magic to Houdini"]
<jeff_s_> was your main problem that you couldn't get ocaml to see the Parser module after all?
<break> well i actually started out with an even simpler example, which i got working
<break> but i was unable to extend it whatsoever and keep it working
<jeff_s_> if you want to keep trying to do it in ML i'll help if you want
<jeff_s_> i'm no parser expert but I've fussed with ocamlyacc
<break> hmm, well, i've got a half-hour or so til i have to leave, so let's see what we can do
<break> do you have git?
<jeff_s_> no but i can install it
<jeff_s_> installing...
<jeff_s_> done
<break> one sec
<jeff_s_> doh! I'm forgetful. Chapter 11 of http://caml.inria.fr/pub/docs/oreilly-book/ is about ocamllex and ocamlyacc
<break> ok, i put the garbage that i have up at http://github.com/pizza/assume/tree/master
<break> i'm embarassed to evne put it up, but who cares
<break> inside the "parsec" folder i have my failed attempts at a c parser
<break> well, the most successful failures
<jeff_s_> which one should I look at?
<break> the ocaml-calc one actually works
rumbleca is now known as rbancroft
<break> but is just a copy of a trivial "calculator" example
<break> using the bnf definition i tried extending that into what became ocaml-try1-broken/
<break> in ocaml-try1-broken the lex.mll.big and parse.mly.big are where i built them up using the full C definition
<mfp> break: there are several C parsers in OCaml...
<break> mfp: ah thank you
<mfp> there's another one; trying to remember
<mfp> there's also CIL, of course, and then another one whose name evades me
<break> yeah i've run across CIL
<break> mfp: how do i install these packages?
<break> (i'm new to ocaml)
<mfp> if you're using GODI, FrontC can be installed from godi_console
<break> and if i'm not?
* mfp is looking for a tarball
<jeff_s_> the source for frontc is included in this, dunno where else http://pauillac.inria.fr/cdk/
<jeff_s_> looks old to me
ulfdoz has quit [Read error: 110 (Connection timed out)]
<break> that seems to install ok, other than the documentation
<palomer> c_syntax.bnf is really short!
<break> and .cmo files are ocaml "modules"?
<jeff_s_> they're your source compiled to ocaml bytecode
<palomer> is there an ocaml library that can parse .bnf files?
<palomer> that would be wicked cool!
<jeff_s_> I have an ocaml library that reads your mind!
* mfp suddenly remembers
<jeff_s_> break - not sure why your calc doesn't work
<break> too bad i'm not a better programmer
itewsh has quit ["There are only 10 kinds of people: those who understand binary and those who don't"]
<break> i assume the ocaml bytecode is portable? can i just copy .cmo files around?
<jeff_s_> broken - got your calc working
<jeff_s_> ya the bytecode you can copy around, keep cmi files with cmo files though, I think it's important
<break> great, now i have a calculator and some c parsers
<break> thank you very much mfp for the links and jeff_s_ for the time
<break> i'll bbiab
* break flies off
<jeff_s_> break - (for when you're back) You changed lexer.ml to lex.ml, so any identifiers in calc.ml that start with "Lexer" need to be changed to "Lex", then it works
<jeff_s_> or rename lex.mll to lexer.mll and change your makefile
<jeff_s_> The reason this works is because ocaml treats each .ml file as a module, and gievs it the name of the file. So everything in lex.ml becomes part of the Lex module.
<jeff_s_> Also it's fun to talk to myself
<break> that is both depressing and reassuring
<break> i think i will like ocaml
<break> thanks for the info, now i'm really away
<jeff_s_> oh you were here after all. see you :)
<jeff_s_> also change Parse.main to Parse.calc. It's Parse.calc because "calc" is the starting node
julm has quit [Read error: 110 (Connection timed out)]
julm has joined #ocaml
Yoric[DT] has joined #ocaml
pizza_ has joined #ocaml
pizza_ is now known as break_
psnively has joined #ocaml
psnively has left #ocaml []
<break_> well, yafce looks really promising, but it doesn't compile
<break_> looks like it requires ocamlmpi, which also appears to not compile
<break_> i'll see if i can get a subset of it working