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!)
ofaurax has quit ["Leaving"]
mrsolo has quit [Connection timed out]
psnively has quit []
mrsolo has joined #ocaml
mrsolo has quit [Read error: 104 (Connection reset by peer)]
mrsolo_ has joined #ocaml
pants1 has joined #ocaml
smimou has quit ["bli"]
seafoodX has joined #ocaml
seafoodX has quit [Client Quit]
pants1 has quit [Read error: 104 (Connection reset by peer)]
david_koontz has quit []
jlouis_ has joined #ocaml
seafoodX has joined #ocaml
jlouis has quit [Read error: 110 (Connection timed out)]
buluca has quit [Read error: 113 (No route to host)]
pants1 has joined #ocaml
Mr_Awesome has quit ["aunt jemima is the devil!"]
jlouis has joined #ocaml
Mr_Awesome has joined #ocaml
jlouis_ has quit [Success]
bebui has quit [Read error: 110 (Connection timed out)]
np has joined #ocaml
bebui has joined #ocaml
np has quit [Remote closed the connection]
pants1 has quit ["Leaving."]
jonathanv has joined #ocaml
mvitale has quit [Read error: 110 (Connection timed out)]
jonafan has quit [Read error: 110 (Connection timed out)]
Tetsuo has joined #ocaml
Tetsuo has quit [Client Quit]
david_koontz has joined #ocaml
david_koontz has quit []
ygrek_ has joined #ocaml
tty56 has quit [Read error: 60 (Operation timed out)]
filp has joined #ocaml
Tetsuo has joined #ocaml
mrsolo_ has quit [Read error: 104 (Connection reset by peer)]
vpalle has joined #ocaml
Tetsuo has quit ["Leaving"]
rwmjones has joined #ocaml
seafoodX has quit []
Yoric[DT] has joined #ocaml
<Yoric[DT]> hi
buluca has joined #ocaml
ita has joined #ocaml
szsz has joined #ocaml
jlouis_ has joined #ocaml
ita has quit ["Hasta luego!"]
jlouis has quit [Read error: 110 (Connection timed out)]
smimou has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
piggybox has quit [Connection timed out]
aij has quit [zelazny.freenode.net irc.freenode.net]
c has quit [zelazny.freenode.net irc.freenode.net]
unfo- has quit [zelazny.freenode.net irc.freenode.net]
c has joined #ocaml
aij has joined #ocaml
unfo- has joined #ocaml
ygrek_ has quit [Remote closed the connection]
mvitale has joined #ocaml
jlouis has joined #ocaml
jlouis_ has quit [Read error: 110 (Connection timed out)]
piggybox has joined #ocaml
authentic has quit [Read error: 110 (Connection timed out)]
seafoodX has joined #ocaml
asmanur has joined #ocaml
seafoodX has quit []
authentic has joined #ocaml
Tetsuo has joined #ocaml
joshcryer has quit [SendQ exceeded]
vorago has quit [SendQ exceeded]
vorago has joined #ocaml
vorago has quit [SendQ exceeded]
vorago has joined #ocaml
unfo- has quit [zelazny.freenode.net irc.freenode.net]
c has quit [zelazny.freenode.net irc.freenode.net]
aij has quit [zelazny.freenode.net irc.freenode.net]
robozni has joined #ocaml
aij has joined #ocaml
c has joined #ocaml
^authentic has joined #ocaml
pango has quit [Remote closed the connection]
authentic has quit [Read error: 110 (Connection timed out)]
^authentic is now known as authentic
pango has joined #ocaml
unfo- has joined #ocaml
joshcryer has joined #ocaml
<rwmjones> does anyone have an example of how to write a C-style string rule in ocamllex? ie. parsing something like "foo\n"
<rwmjones> s/parsing/scanning/
<asmanur> does | "foo" -> result not work ?
schme` has quit [Connection timed out]
<rwmjones> ummm...?
<asmanur> rwmjones: what's your string exactly ?
<rwmjones> well that's the point, I want to scan any C-style string
<rwmjones> ie.
<rwmjones> double-quote f o o backslash n double-quote
<rwmjones> replace the bits inside double-quotes with whatever
<asmanur> er :p
<vorago> rwmjones, hm.
<vorago> rwmjones, in OCaml you mark \n just like in C.
ygrek_ has joined #ocaml
mvitale_ has joined #ocaml
<vorago> \"x\"
<vorago> You want to find/replace occurences of \"[^\\]+\" and replace with something like \"y\" ?
<vorago> Maybe Str module?
<vorago> let re = Str.regexp "\\\"\\(\n*.*\\)*\\\"";;
<vorago> # Str.global_replace re "found" "\"\nlgfdsgdf\na\" tt";;
<vorago> - : string = "found tt"
* vorago loves regexes. ;P
mvitale has quit [Read error: 110 (Connection timed out)]
<vorago> "\"\\(\n*.*\\)*\"" simplified
buluca has quit [No route to host]
bluestorm_ has joined #ocaml
<rwmjones> vorago, asmanur thanks for your suggestions, but in fact I'm trying to write an ocamllex rule. In any case I worked it out:
<rwmjones> | '"' {
<rwmjones> Buffer.clear buffer;
<rwmjones> scan_string lexbuf;
<rwmjones> let s = Buffer.contents buffer in
<rwmjones> STRING s
<rwmjones> }
<rwmjones> and then later:
<rwmjones> and scan_string = parse
<rwmjones> (* end of string: return *)
<rwmjones> | '"' { () }
<rwmjones> (* escaped double-quote *)
<rwmjones> | '\\' '"' { Buffer.add_char buffer '"'; scan_string lexbuf }
<rwmjones> (* escaped backslash *)
<rwmjones> | '\\' '\\' { Buffer.add_char buffer '\\'; scan_string lexbuf }
<rwmjones> (* end of file - unclosed string *)
<rwmjones> | eof { fatal lexbuf "unclosed string in file" }
<rwmjones> (* standard character *)
<rwmjones> | _ as c { Buffer.add_char buffer c; scan_string lexbuf }
xavierbot has joined #ocaml
<bluestorm_> rwmjones: i don't think it's possible
<bluestorm_> yacc is basically about making a tree from a plain token stream
<rwmjones> bluestorm_, I was beginning to think that ...
<bluestorm_> maybe you could give it a tree by flattening it into a stream before
<bluestorm_> but i'm not sure it will be easy for you to preserve the structure while doing this
<rwmjones> unfortunately my proposed language is context-sensitive on the current contents of the tree
<bluestorm_> hm, seems rather non-trivial :p
<rwmjones> it actually is possible if I hack the generated .mli file
<rwmjones> eg. to add a reference to the tree to the .mly & .mli which I can then set in the lexer
<rwmjones> but I don't understand if that is going to break something deep
<rwmjones> if I just add (to the mly): let tree = ref [];; I can't see/update that in the lexer because of the generated parser.mli file. But if I add the signature to the parser.mli file by hand, then the lexer can set it at the start of the file
<rwmjones> & the parser commands can see/use/update the tree
ita has joined #ocaml
<bluestorm_> that sounds like dark magic to me
<bluestorm_> but as i don't know what you're really trying to do, and you must be the best one to find it out anyway... :p
<rwmjones> yes well the tree example is made up, but the problem that I'm trying to solve is real, for sure :-)
<rwmjones> but I could still imagine a tree language like:
<rwmjones> set node.attr = "foo";
<rwmjones> where 'node' would be the name of a node in an existing tree
<rwmjones> I'm not explaining this well ...
<rwmjones> I want to write a command line tool like this:
<rwmjones> $ transform tree.data commands > tree.data
<rwmjones> where commands is a list of commands to perform on the tree
<rwmjones> so if the existing tree just had a single root node called 'root'
<rwmjones> then a valid command would be
<rwmjones> set root.color = "blue";
<rwmjones> this command should fail if there is no node in the tree called 'root', but otherwise it should update the tree
smimou has quit ["bli"]
filp has quit ["Bye"]
l_a_m has quit [Remote closed the connection]
l_a_m has joined #ocaml
vpalle has quit [Read error: 113 (No route to host)]
Vital303 has joined #ocaml
CRathman has joined #ocaml
Torment has joined #ocaml
asmanur has quit [Remote closed the connection]
Jedai has quit [Read error: 110 (Connection timed out)]
ita has quit [Remote closed the connection]
buluca has joined #ocaml
filp has joined #ocaml
Vital303 has quit [Remote closed the connection]
Tetsuo has quit ["Leaving"]
ygrek_ has quit [Remote closed the connection]
Tetsuo has joined #ocaml
ygrek_ has joined #ocaml
bluestorm_ has quit ["Konversation terminated!"]
xavierbot has quit [Read error: 110 (Connection timed out)]
thesoko has joined #ocaml
filp has quit ["Bye"]
Mr_Awesome has quit [Read error: 110 (Connection timed out)]
piggybox has quit [Read error: 110 (Connection timed out)]
pango has quit [Remote closed the connection]
pango has joined #ocaml
Tetsuo has quit [Remote closed the connection]
Tetsuo has joined #ocaml
ygrek_ has quit [Remote closed the connection]
robozni has quit ["leaving"]
robozni has joined #ocaml
piggybox has joined #ocaml
Yoric[DT] has joined #ocaml
Tetsuo has quit ["Leaving"]
CRathman has quit ["ChatZilla 0.9.78.1 [Firefox 2.0.0.8/2007100816]"]
david_koontz has joined #ocaml
l_a_m has quit [Remote closed the connection]
Mr_Awesome has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]