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!)
ulfdoz has quit ["arg!"]
ulfdoz has joined #ocaml
mnemonic has quit [Read error: 110 (Connection timed out)]
noteventime has quit ["Leaving"]
gim__ has joined #ocaml
Oatmeat has joined #ocaml
<Oatmeat> how can I determine the current file name from within a ocamlyacc grammar?
<mikeX> Oatmeat: I've seen it done with a camlp4 module
<Oatmeat> in general is there an easy way to pass information to ocamlyacc?
<Oatmeat> it generates its own mli file which hides any functions in your mly file
<mikeX> Oatmeat: you can import modules in the 1st section
<Oatmeat> right, but I'm looking to expose a function outside the mly file
<Oatmeat> so I can call a function like setCurrentFileName
gim_ has quit [Read error: 110 (Connection timed out)]
<mikeX> not sure I understand why you want to do that
<Oatmeat> well the parser is going to read a declaration at the top of the file which gives the module name
<Oatmeat> and I want to ensure that the module name is consistent with the file name
<Oatmeat> so if I parse file.mod, I expect a line like "module file"
<mikeX> ok, but why do you need to call something defined in the parser?
<Oatmeat> well I just need the parser to know the file name
<Oatmeat> so I was going to add a reference variable in the parser
<Oatmeat> and have the setCurrentFilename function modify that variable
<mikeX> add the reference value somewhere else, and update it from within the parser
<mikeX> Oatmeat: I'm confused actually, which filename are you refering to?
<mikeX> what sort of program are you writing?
<Oatmeat> the name of the file being parser
<Oatmeat> parsed
<Oatmeat> the program is a compiler
<mikeX> well that's something you should know from the environment
<mikeX> a command line parameter passed to your compiler for example
<Oatmeat> right
<Oatmeat> I do have the filename in my program
<Oatmeat> I just don't know how to make the parser aware of the filename
<mikeX> simple, store it somewhere as a global variable
gim__ has quit []
<mikeX> for example, if you have a module Utils, you could store it there as a global variable, and retrieve it from the parser with Open Utils
<mikeX> maybe there's a better way
<mikeX> like giving it as a parameter to your parsing function
<mikeX> I only used filenames for error reporting in my compiler, so I storred it in some structure in a module Error, where the appropriate error reporting functions used it
<Oatmeat> alright, I'll try that
<Oatmeat> thanks
<Oatmeat> thanks
<mikeX> that's the structure I used, but it has to be updated manually from within the lexer I think
<Oatmeat> yeah I wasn't sure how pos_fname gets set for that structure
<Oatmeat> because when I used it, pos_fname was the empty string
<Oatmeat> so I guess I have to set it myself at some point
<Oatmeat> not sure how to do that in the lexer
<mikeX> yes, but only if you need it
<mikeX> you can just set fname at the start, and read it from within the parser
<Oatmeat> do you know how to set it?
<mikeX> let main file =
<mikeX> let ic = open_file file in
<mikeX> if !flag_verbose = Vverbose then printf "-> opening '%s'\n%!" file;
<mikeX> let lexbuf = Lexing.from_channel ic in
<mikeX> lexbuf.lex_curr_p <- { lexbuf.lex_curr_p with pos_fname = file };
<mikeX> try
<Oatmeat> I didn't know how to get ahold of the position structure
<mikeX> while true do Alan_parser.program Alan_lexer.lexer lexbuf done
<mikeX> with
<mikeX> that's an extract of my controlling function
<Oatmeat> ah ok
<Oatmeat> so just modify lexbuf.lex_curr_p I guess
<mikeX> then in the lexer i call this in almost every rule:
<mikeX> let incr_pos lexbuf = g_position := position_context lexbuf.lex_start_p lexbuf.lex_curr_p
<mikeX> hmm, it seems I kept a global var of the position, can't remember why
<mikeX> i wrote that a year ago
<Oatmeat> I think position gets tracked automatically
<Oatmeat> you just need an incrline function for detecting newlines
<mikeX> yeah I have that too
<mikeX> hmm, I use a special position type
<mikeX> type position =
<mikeX> PosPoint of Lexing.position
<mikeX> | PosContext of Lexing.position * Lexing.position
<mikeX> | PosDummy
<mikeX> well that part is not my code, so I can't recall the logic behind it now
<mikeX> let incr_line lexbuf =
<mikeX> lexbuf.lex_curr_p <- { lexbuf.lex_curr_p with
<mikeX> pos_lnum = lexbuf.lex_curr_p.pos_lnum + 1;
<mikeX> pos_bol = lexbuf.lex_curr_p.pos_cnum;
<mikeX> };
<mikeX> if !flag_verbose = Vverbose then printf "line %d\n%!" lexbuf.lex_curr_p.pos_lnum
<mikeX> and that's for newlines
<mikeX> what's the compiler for? school project?
<Oatmeat> research project for a fellow student
<Oatmeat> I'm helping her with setting up the build process
<Oatmeat> and so I had to remove a cyclic dependency between her lexer and parser due to this filename issue
<mikeX> oh I see
<mikeX> gotta go, goodnight
mikeX has quit ["leaving"]
jeffs has joined #ocaml
shekmalhen has quit ["Méritez votre liberté, fainéants"]
Ai_Itai has quit ["Leaving"]
malar has quit ["Lost terminal"]
bzzbzz has joined #ocaml
bzzbzz has quit [Client Quit]
<kelaouchi> is there any Qt binding for OCaml ?
jeffs has quit [Read error: 54 (Connection reset by peer)]
tree_ is now known as tree
tree is now known as trisiak
trisiak is now known as tree
_JusSx_ has joined #ocaml
Mr_Awesome has quit ["...and the Awesome level drops"]
smimou has joined #ocaml
<kelaouchi> Any idea ?
mnemonic has joined #ocaml
BleSS has joined #ocaml
<BleSS> Hi! it would be interesting that somebody would write the version in ocaml for Fractal Benchmark - http://www.timestretch.com/FractalBenchmark.html
<BleSS> I'm not the author of that page, but I thinked that would interesting to add another languages to make a reasonable performance comparison - to contact with the author: erik@timestretch.com
<pango> btw I suspect some versions compute the set for -39..39/-39..39 ranges, others for -39..38/-39..38 only
mnemonic has quit [Read error: 104 (Connection reset by peer)]
<BleSS> pango: thanks
joshcryer has quit [Read error: 104 (Connection reset by peer)]
joshcryer has joined #ocaml
BleSS has quit ["Konversation terminated!"]
bluestorm_ has joined #ocaml
rwmjones has joined #ocaml
ezraburgh has joined #ocaml
<G> rwmjones: oh hey
<rwmjones> hello - Nigel Jones, right?
<G> thats the one
<rwmjones> I've got a big queue of packages to be reviewed .. no one seems much interested in them unfortunately :-(
<G> rwmjones: oh, I found out the hold up for Fedora sponsorship, apparently it's because they'd perfer that the draft guidelines became final ;)
<G> rwmjones: but I do have a few comments on the package I was looking at, I'll just have to look at my buildlogs
<rwmjones> ok
<G> rwmjones: oh yeah, you have a missing builddep on ocaml-findlib
<G> (m4)
<rwmjones> in which package is that?
<G> I believe the package is just m4 ;)
<rwmjones> m4?
<G> yep
<rwmjones> the macro preprocessor?
<rwmjones> ah, right got you
<G> yeah, it's not in the default build environments
<rwmjones> you mean ocaml-findlib builddeps m4!
* rwmjones thought you meant the other way around for a minute there ...
<G> rwmjones: oh whoops, sorry ;)
<rwmjones> ok, I've added that in my private copy
<rwmjones> did you get the find-requires/find-provides stuff working? and what did you think?
<G> want to build another -1?
<rwmjones> for ocaml-findlib? here I'm up to release -2 becaues I added the find-requires/find-provides stuff
<G> oh right,
<rwmjones> is there a problem with reviewing/releasing with release numbers > 1?
<G> no, not at all
<G> I had one that reached -6 by the time it was accepted
<G> rwmjones: btw, I'm working on getting a 3.10.0 ocaml package ready
<rwmjones> ok, so there's the -3 release which has that builddep
<rwmjones> yup, it's a good idea. However at the moment I'm conservatively sticking with 3.09.3 because of all the camlp4 changes in the latest.
<rwmjones> I sent Gerard some patches against the base ocaml. Shall I send them to you?
<G> I'll see if I can convince gemi to include those ocaml-find-provides/requires stuff then
<G> if you want, I'm actually the maintainer of the EL- branches
<rwmjones> ok, I mailed you one patch - it just makes sure that tools/objinfo gets packaged, works same way as Debian
<G> ahhh right, I think I ran into that problem building 3.10.0
<rwmjones> the other patch is ocaml-find-*.sh, here: https://www.redhat.com/archives/fedora-devel-list/2007-May/msg01693.html
<rwmjones> (that patch is cumulative over the one I sent you by email)
<G> yeah, I saw the ML patch
ygrek has joined #ocaml
screwt839 has joined #ocaml
screwt8 has quit [Read error: 104 (Connection reset by peer)]
screwt839 has left #ocaml []
<rwmjones> G, I'm off now, but I've just done packages for ocamlnet, ssl, ulex and pxp
<rwmjones> all based on OCaml 3.09.3
rwmjones has quit ["Closed connection"]
EliasAmaral has quit [Success]
noteventime has joined #ocaml
mnemonic has joined #ocaml
ezraburgh has quit []
rwmjones has joined #ocaml
Riesz has quit ["Leaving.."]
Riesz has joined #ocaml
orcamsmacro has joined #ocaml
orcamsmacro has left #ocaml []
_JusSx_ has quit ["leaving"]
pango has quit [Remote closed the connection]
pango has joined #ocaml
pango has quit ["Terminated with extreme prejudice - dircproxy 1.0.5"]
pango has joined #ocaml
malar has joined #ocaml
tree has quit [Nick collision from services.]
tree_ has joined #ocaml
rwmjones has quit ["Closed connection"]
screwt8 has joined #ocaml
benny__ has joined #ocaml
malar has quit [Read error: 110 (Connection timed out)]
benny_ has quit [Read error: 110 (Connection timed out)]
JeffSmac has joined #ocaml
schme has joined #ocaml
bluestorm_ has quit ["Konversation terminated!"]
benny__ is now known as klapmuetz
JeffSmac has quit []
piggybox has quit [Read error: 60 (Operation timed out)]
<kelaouchi> ok thx pango
<Smerdyakov> You're welcome.
slipstream-- has quit [Read error: 104 (Connection reset by peer)]
slipstream has joined #ocaml
ygrek has quit []
mnemonic has quit ["leaving"]
Mr_Awesome has joined #ocaml
screwt8 has quit [Remote closed the connection]
_JusSx_ has joined #ocaml
screwt8 has joined #ocaml
descender has quit [Remote closed the connection]
_JusSx_ has quit ["leaving"]
smimou has quit ["bli"]
descender has joined #ocaml
descender has quit [Remote closed the connection]
mwc has joined #ocaml
bluestorm_ has joined #ocaml
bzzbzz has joined #ocaml
scruffie has joined #ocaml