pango has quit [Read error: 110 (Connection timed out)]
aegray_ has joined #ocaml
<aegray_>
i'm quite confused: This expression has type unit -> lambda_token but is here used with type
<aegray_>
unit -> lambda_token
<aegray_>
why is that an error?
<dylan>
Perhaps some kind of syntax error?
<aegray_>
k
stavrogin has joined #ocaml
aegray_ has quit [Remote closed the connection]
<stavrogin>
hi.. after downloading ocaml and trying to compile it segfaults while running ocamlcomp.sh in a random .ml file, (gcc 4.0.2, glibc 2.35) is anything broken with ocaml, or is my installation??
rq has quit [Read error: 104 (Connection reset by peer)]
rq has joined #ocaml
<Smerdyakov>
Who knows. Welcome to the era of gcc 4.
Skal has joined #ocaml
Snark has joined #ocaml
Skal has quit [Read error: 110 (Connection timed out)]
Skal has joined #ocaml
vodka-goo has joined #ocaml
Submarine has joined #ocaml
ski has quit [Read error: 110 (Connection timed out)]
ski has joined #ocaml
m3ga has joined #ocaml
pango_ has quit [Remote closed the connection]
pango has joined #ocaml
Bigb[a]ng has quit [Read error: 110 (Connection timed out)]
Amorphous has quit ["arg... must... shutdown... computer burnin..."]
_fab has joined #ocaml
Amorphous has joined #ocaml
_fab has quit [Read error: 104 (Connection reset by peer)]
ppsmimou has joined #ocaml
_fab has joined #ocaml
<det>
Smerdyakov, Ocaml just uses GCC as an assembler, I dont think that statement was very fair :-)
<vodka-goo>
I was wondering.. is it possible to cross compile with OCaml ? Produce ARM asm from my intel arch ?
<vodka-goo>
I just never did that, and seen nothing in man/--help
<ppsmimou>
vodka-goo: look at the list's archive, there was a patch for that if I remember well
<vodka-goo>
strange that it's only a patch... shouldn't it be a command-line switch ?
<vodka-goo>
I don't even know how it works with gcc actually :p
<vodka-goo>
thanks ppsmimou anyway
revision17_ has quit [Read error: 110 (Connection timed out)]
* Submarine
feels the bile rising from his guilty past
<ppsmimou>
which guilty past ?
vodka-goo has quit [Read error: 54 (Connection reset by peer)]
mattam has quit [Connection timed out]
Banana has quit [Read error: 110 (Connection timed out)]
<justinc>
which List/Hashtbl operations should be avoided when you do alot of them and want to avoid getting 'Out_of_memory' exceptions ..
<m3ga>
check the docs. you should avoid any which are not tail recursive. those that aren't will say so in the docs.
Banana has joined #ocaml
mattam has joined #ocaml
vodka-goo has joined #ocaml
Skal has quit [Remote closed the connection]
Skal has joined #ocaml
m3ga has quit ["disappearing into the sunset"]
stavrogin has quit ["Leaving"]
Bigb[a]ng has joined #ocaml
Snark has quit [Read error: 110 (Connection timed out)]
Snark has joined #ocaml
<justinc>
m3ga: ok I wondered if all not-tail-recursive are mentioned in the doc (because so few are explicitely said to be not tail recursive)
<pango>
list.mli looks correct, haven't looked at hashtbl.mli yet...
Boojum has joined #ocaml
Snark has quit [Read error: 110 (Connection timed out)]
Boojum is now known as Snark
<pango>
Hashtbl case look slightly more complex; Most functions are not tail-recursive vs. one/each bucket; Since the invariant is to keep at most 2 elements/bucket, it is *very* unlikely (yet not impossible) you get a stack overflow from them
<pango>
(at most, _on average_, sorry)
<pango>
for completeness, default generic hashing function is probably not tail-recursive vs. each element too (C stack that time)
<pango>
mmh recursion is bound by the limit parameter. Never mind
<justinc>
is Out_of_memory for native compiled code a sign for Stack_overflow? ..
<justinc>
hm no. just ran it with ocamlc and get Out_of_memory
_JusSx_ has joined #ocaml
<justinc>
oh
<justinc>
could it be that structural equality leads to Out_of_memory?
<justinc>
yes. that's it.
<vincenz>
Anyone know how to use ocaml Graphics from cygwin
<vincenz>
nm
batdog|gone is now known as batdog
<vincenz>
nm
batdog is now known as batdog|gone
batdog|gone is now known as batdog
_fab has quit [Remote closed the connection]
batdog is now known as batdog|gone
__DL__ has joined #ocaml
batdog|gone is now known as batdog
batdog is now known as batdog|gone
batdog|gone is now known as batdog
<vincenz>
Anyone use ocamlyacc?
<dylan>
A little
<vincenz>
Is it possible to match on the internal data inside a token?/
<vincenz>
%token <string> OP
<vincenz>
Can I use the string in my rules?
<dylan>
I think that belongs in the lexer.
<dylan>
but in theory, you could have it return a different AST representation for different values...:
<dylan>
expr OP expr { if $2 = "blaa" then Pants($1, $2) else Shirt($1, $2)
<dylan>
}
<dylan>
er
<dylan>
$1, $3 of course.
<vincenz>
k
<vincenz>
how do you pass extra params to the parser?
batdog is now known as batdog|gone
<vincenz>
I have an extra parameter in the lexer whiich is an identifier lookup table
batdog|gone is now known as batdog
<vincenz>
I want the parser to add to this as it parsers
<vincenz>
parses even
<vincenz>
Ever use tywith?
<dylan>
hmm?
<dylan>
well
<dylan>
the lexer could return a tuple.
Raziel has quit ["Yo soy goma. Tú eres cola."]
<dylan>
you'd have to say something like: %token <string * int> OP, so it could pass a string and an int.
<vincenz>
does parsing drive lexing
<vincenz>
or is lexing fully done upfront?
<dylan>
parsing drives lexing, I think.
Skal has quit [Read error: 104 (Connection reset by peer)]
Skal has joined #ocaml
<vincenz>
blegh
<vincenz>
I wish there was a way to have ocamlyacc automatically generate a to_string for the %tokens it defines
<vincenz>
dylan: ever use tywith?
<Smerdyakov>
vincenz, not sure about w/ ocamlyacc, but you can do that with camlp4 for regular OCaml code.
<vincenz>
Smerdyakov: yeah, tywith does it
* vincenz
grrs
<vincenz>
# let lexbuf = Lexing.from_channel (open_in "test2") in
<vincenz>
Nonetheless Model.mli defines the type... so why is it abstract
<vincenz>
odd
<vincenz>
This kind of expression is not allowed as right-hand side of `let rec'
<vincenz>
this is the offending line
<vincenz>
and string_of_body = Tywith.string_of_list string_of_statement
ppsmimou has quit ["Leaving"]
gim has quit [Read error: 104 (Connection reset by peer)]
gim has joined #ocaml
gim has quit [Remote closed the connection]
gim has joined #ocaml
Bigb[a]ng is now known as Bigbang
smimou has joined #ocaml
shirogane has joined #ocaml
batdog is now known as batdog|gone
batdog|gone is now known as batdog
pango has quit ["Leaving"]
pango has joined #ocaml
batdog is now known as batdog|gone
batdog|gone is now known as batdog
Schmurtz has joined #ocaml
_fab has joined #ocaml
Snark has quit ["Leaving"]
Bigbang is now known as Bigb[a]ng
xidaux has joined #ocaml
<xidaux>
Hello, anyone around ?
<vodka-goo>
kind of..
mdmkolb1 has joined #ocaml
<mdmkolb1>
I know that internally ocaml does integer addition as "x + y - 1" because of the 31 bit representation. Are there any tricks for how it does multiplication and devision?
<dylan>
I thought that one bit was used to determine if it was a block or not?
<mdmkolb1>
It is so the add machine instruction will try to add 2a + 1 and 2b + 1
<mdmkolb1>
we want 2(a+b) + 1
<mdmkolb1>
where x = 2a+1 and y = 2b+1
<mdmkolb1>
x + y - 1 = 2(a+b) - 1
<mdmkolb1>
which only takes two machine instructions
<vincenz>
Hi
<vincenz>
anyone know how to get more detailed error than just Parsing.parse_error?
<mdmkolb1>
for multiply the best expresion I can think of is (x*y)-x-y+1 which is *four* machine instructions. I'm just wondering if there is a faster way that ocaml might use
<vodka-goo>
vincenz: you can track position in the lexbuf to help, or you can add failure rules in the parser for meaningful errors
<vincenz>
vodka-goo: how would I do that?
<vincenz>
the first part that is
<vodka-goo>
I don't know, I never did :p OCaml parser does that...
<vodka-goo>
ah the first part..
<vodka-goo>
for this you just have to modify the mutable fields of the lexbug when meeting a newline
<vodka-goo>
I don't have time to google it for you but it's very common trick (OCaml lexer do it too of course)
<vincenz>
and then just catch the exception and print lexbuf stuff
<vincenz>
got it
<vincenz>
now just gotta update the line number :)