<SoftTimur>
should i first use ocamllex or ocamlyacc?
<flux>
softtimur, hmm.. you would use both.
<flux>
softtimur, perhaps in practice the first step is to write a lexer, even an incomplete one, and then start building the parser
<flux>
and the parser would produce an AST and you might write an interpreter for that, or possibly have some intermediate language
<SoftTimur>
larhat: thanks for the link
wtetzner has quit [Remote host closed the connection]
<SoftTimur>
flux: the first step would be to write a lexer by ocamllex?
<flux>
softtimur, well, if you go that way you have more early a version that can accept actual code
<flux>
softtimur, if you write parser first, you need to create sequences of tokens in Objective Caml data format you feed to it
<flux>
I guess it depends on the person what he wants to accomplish first
<SoftTimur>
flux: i just would like to find a easiest way to start
oriba has joined #ocaml
<flux>
softtimur, perhaps you should look at the ocaml manual then, it has a section on lexers and parsers, with a complete example
<SoftTimur>
flux: "if you go that way you have more early a version that can accept actual code" ==> you mean i could have a version which works very soon?
Yoric has quit [Quit: Yoric]
<thelema>
SoftTimur: you can have a version which partially works very soon.
<flux>
softtimur, it is the difference of having a program that accepts let a = "hello world" and a library that is called like evaluate [T_Let, T_Ident "a", T_Equal, T_String "hello world"]
<flux>
(, is obviously ; in that..)
dnolen has joined #ocaml
<SoftTimur>
flux: i guess "let a = "hello world"" is accepted by a version generated by ocamllex?
<SoftTimur>
thelema: ok...
<flux>
softtimur, well, yes, depending on your lexer :)
<flux>
but it might very well accept let a = = = = = = as well, if you don't have a parser..
<SoftTimur>
cool, i think i see generally what you mean... i will first read the lexer and parser part of ocaml manual...
<SoftTimur>
thank you all
SoftTimur has left #ocaml []
SoftTimur has joined #ocaml
<thelema>
type ('a,'b) pair = {_0:'a; _1:'b}
groovy2shoes has joined #ocaml
groovy2shoes has quit [Client Quit]
<flux>
?
<thelema>
flux: I was just looking at rust, and their tuples have record-like access to components
ttamttam has quit [Ping timeout: 276 seconds]
avsm has joined #ocaml
<SoftTimur>
hello all, i am now editing a .mly with Emacs, does anyone know how should i configure the Tuareg?
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
<thelema>
SoftTimur: tuareg doesn't do too bad on .mly files
<thelema>
oh yeah, except the auto-indenting doesn't work.
<thelema>
just make sure your rules start at the beginning of the line and the rest should work out
<SoftTimur>
thelema: that is what i wanted to say...
<thelema>
just don't auto-indent anything that doesn't start |
<SoftTimur>
thelema: i see your point, actually it is not that bad... thank you
ymasory has joined #ocaml
avsm has quit [Quit: Leaving.]
myu2 has quit [Remote host closed the connection]
boscop_ has joined #ocaml
ttamttam has joined #ocaml
Cyanure has joined #ocaml
dnolen has quit [Quit: dnolen]
edwin has quit [Quit: Leaving.]
lopex has quit []
yezariaely has joined #ocaml
rwmjones has quit [Ping timeout: 241 seconds]
notk0 has joined #ocaml
notk0 has left #ocaml []
avsm has joined #ocaml
rwmjones has joined #ocaml
philtor has joined #ocaml
vivanov has joined #ocaml
notk0 has joined #ocaml
<notk0>
hello , I have a match withing a match, how can I end the second match?
<thelema>
use () around the second match
<hcarty>
notk0: You can wrap the inner match in "begin .. end" or ( )
<thelema>
or begin/end if you like words better
<notk0>
thank you, I will try that
<notk0>
thank you that seem to work properly, at least the cursor goes at the right place in emacs now
oriba has quit [Quit: Verlassend]
joewilliams_away is now known as joewilliams
<thelema>
yay emacs for reducing bugs
<notk0>
tuareg :P
<notk0>
BTW, does anybody here use menhir?
<thelema>
notk0: a little
avsm has quit [Quit: Leaving.]
<notk0>
thelema, are you familiar with this error: "Error: Two productions that share a semantic action must define
<notk0>
exactly the same identifiers.
<notk0>
"
<thelema>
haven't run into that one. I think it's similar to the error when combining match clauses
<notk0>
I tried to read the manual but didn't understand anything :X
<thelema>
match (1,3) with (1,a) | (b,3) -> ...
<notk0>
thelema, that error comes from menhir
<thelema>
do you see what the problem with this match statement is?
<thelema>
yes, I'm sure it's the same kind of problem as this.
<thelema>
you have two productions that share an action, right?
<notk0>
thelema, the part that gives an error was not written by me, it was written by my partner today I think
<notk0>
what does two productions that shaer an action mean?
<thelema>
in the two productions, you *must* bind the same variables. If you don't, the shared action isn't guaranteed to work.
<notk0>
thelema, sorry I don't understand
<notk0>
I think the error might come from empty production units
<thelema>
exp: exp PLUS exp | exp MINUS exp -> {Op($1, $2, $3)}
<notk0>
thelema, actually I found the error, I feel stupid now
<thelema>
this is two productions (e+e, e-e) that share a semantic action
<thelema>
it could be just a missing action
<notk0>
it was because there were a lot of empty productions with todo comments
<thelema>
use "assert false" or "raise Not_implemented"
<notk0>
thelema, silly me, I removed them XD
<notk0>
also thank you for the help thelema
<thelema>
now you know.
Yoric has joined #ocaml
yezariaely has quit [Quit: Leaving.]
larhat has quit [Quit: Leaving.]
<philed>
hcarty: No bug.
<philed>
hcarty: "lwt s = Lwt_io.read_line Lwt_io.stdin;;" won't work.
<philed>
However: you can write "let t = Lwt_io.read_line Lwt_io.stdin in lwt s = t in return s"
<hcarty>
philed: Cool, thank you for letting me know
<philed>
Cheers for your time, anyway. Thought it would be good to get some closure :)
<hcarty>
Definitely - better to know than not :-)
ttamttam has quit [Remote host closed the connection]
pheredhel` has quit [Ping timeout: 276 seconds]
sepp2k has joined #ocaml
<flux>
I guess it must work that way, because for example let a = 42 is not an expression, it's a statement
<flux>
but anything in a monad is an expression
<flux>
(let a = 42 in a is an expression)
pheredhel has joined #ocaml
ymasory has quit [Quit: Leaving]
_unK has joined #ocaml
drunK has quit [Ping timeout: 252 seconds]
diml has quit [Ping timeout: 264 seconds]
diml has joined #ocaml
drunK has joined #ocaml
eye-scuzzy has quit [Ping timeout: 248 seconds]
_unK has quit [Ping timeout: 276 seconds]
boscop__ has joined #ocaml
boscop_ has quit [Read error: Connection reset by peer]
enthymeme has joined #ocaml
boscop_ has joined #ocaml
boscop__ has quit [Ping timeout: 246 seconds]
<philed>
flux: Is that the problem, though. I was going to put it down to it not liking the function application, and just wanting a single identifier.
_unK has joined #ocaml
drunK has quit [Ping timeout: 246 seconds]
<_habnabit>
So, I'm profiling an ocaml application. Nearly 45% of the time is spent in either `mcount` or `__mcount_internal`. Is this normal?
avsm has joined #ocaml
eye-scuzzy has joined #ocaml
AdultSwim has joined #ocaml
ulfdoz has joined #ocaml
ygrek has joined #ocaml
Snark has quit [Quit: Ex-Chat]
boscop_ has quit [Ping timeout: 246 seconds]
ymasory has joined #ocaml
scooty-puff has joined #ocaml
<scooty-puff>
is the ocaml module language turing complete?
<scooty-puff>
i've been banging at something for a bit, and it seems like no
<scooty-puff>
(to ensure compilation terminates?)
<hcarty>
scooty-puff: Possibly not... 3.12.x and 3.13.x may bring it closer?
<scooty-puff>
hcarty, looked like they have first-class modules, but i imagine most of this is at runtime (though it would be cool if its smart enough to shift to compile-time what it can)