<eskatrem>
Hi, if a file has "open Module", where `Module` is another file, how can I load my file in the REPL?
<oni-on-ion>
#mod_use "module.ml";;
<dh_work>
is it reasonable to create an empty .mli file for a main module, to allow warning about unused bits in it and also hopefully warning if you forget to actually _do_ anything?
mfp has quit [Ping timeout: 258 seconds]
<eskatrem>
it works with #user "module.ml"
<eskatrem>
but the problem is that I cannot just load the file containing "open Module" in the REPL
<eskatrem>
also I want to use an .mly file...
<oni-on-ion>
dh_work, i notice that modules are not warned about being unused, perhaps stuff them in one ?
<oni-on-ion>
eskatrem, that is why, #mod_use , as opposed to #use.
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<oni-on-ion>
(see #help;;)
<eskatrem>
oni-on-ion #mod_use works for mly file? nice
<oni-on-ion>
i am not sure why you are still describing your problem without trying the solution given to you.
<eskatrem>
hmm no it doesnt
<oni-on-ion>
it does for me. what is the error ?
<oni-on-ion>
don't need to open Module, just do Module.some_func
<eskatrem>
File "parser.mly", line 15, characters 0-1:
<eskatrem>
Error:Parse error: illegal begin of use_file
<eskatrem>
line 15 is: %token <int> INT
<oni-on-ion>
oh - i don't know mly. you possibly need extra stuff
<eskatrem>
yes, possibly
<oni-on-ion>
is it ocamlyacc, not menhir ?
<eskatrem>
menhir
keep_learning_M has joined #ocaml
<dh_work>
I wasn't clear
<oni-on-ion>
hmm
<dh_work>
I have main.ml with let main () = stuff in it, and also a let _ = main ()
<dh_work>
(whether this is reasonable is a different debate)
<dh_work>
if I also have let foo () = otherstuff and I forgot to use it, I'll only get a warning about that if there's an .mli file so the compiler knows what's potentially used from outside
<oni-on-ion>
not a problem, im learning about it too. =)
<oni-on-ion>
(so im sorry for not being clear and a bit explorative)
<eskatrem>
in the last link you passed me, "Using Menhir as an interpreter", I think it means "making an interpreter with Mehnir", not "use Menhir from the interpreter [toplevel]"
<oni-on-ion>
it looks like the normal usage is as dh_work says, to create the .ml from the .mly ;; but menhir has --interpreter mode to help. but surely there is a more direct way to use it in REPL.
<eskatrem>
I have to reboot my connection. brb
<oni-on-ion>
eskatrem, nope. did you read the first sentence? ---> "8 Using Menhir as an interpreter. When --interpret is set, Menhir no longer behaves as a compiler. Instead, it acts as an interpreter. That is, it repeatedly: "
<eskatrem>
hmm yes, that means "making an interpreter with Mehnir" to me
jao has quit [Ping timeout: 246 seconds]
<oni-on-ion>
it actually says "Using Menhir as an interpreter."
<oni-on-ion>
if you can read the english
<oni-on-ion>
the statement i quoted, i will repeat again, because i can no longer help due to persistent miscommunication. not sure if you understand that.
<oni-on-ion>
"8 Using Menhir as an interpreter. When --interpret is set, Menhir no longer behaves as a compiler. Instead, it acts as an interpreter. That is, it repeatedly: "
<eskatrem>
... reads a sentence off the standard input channel;
<eskatrem>
parses this sentence, according to the grammar;
<eskatrem>
displays an outcome.
<eskatrem>
that is an interpreter, yes
<oni-on-ion>
if you will continue to pass over suggested solutions without trying any of them, and if you don't want your problem solved, then why involve other people?
<oni-on-ion>
it feels like we are going in circles, sorry.
jmiven has quit [Quit: co'o]
q9929t has joined #ocaml
jmiven has joined #ocaml
<eskatrem>
sorry maybe I was not clear in what I want to do: I have a file calc.ml in the Menhir demo that gets some string representing a math operation from the command line, and tries to calculate it
<eskatrem>
what I am trying to do is run the function `process` from this file, but on the toplevel
<oni-on-ion>
then #use "calc.ml";; then call it
<oni-on-ion>
as for mly file, needs to be processed with menhir
<eskatrem>
ok, so that's the problem: when I do `#use "calc.ml";;", it says: Error: Unbound value Parser.main, and I cannot make the toplevel get Parser.main because it's in the file parser.mly that is not ocaml language
<oni-on-ion>
does your build command accept '-use-menhir' ? corebuild does
<oni-on-ion>
yeah ... need to use menhir to process that file first, parse.mly
<oni-on-ion>
parser.mly **
<oni-on-ion>
try just 'menhir parser.mly' , i dont know the tool personally
<oni-on-ion>
then calc should find Parser
<eskatrem>
hmm running the repl with `ocaml -use-menhir` fails...
<oni-on-ion>
i just tried that too =)
<oni-on-ion>
ocamlbuild supports it
<oni-on-ion>
hmmm
q9929t has quit [Ping timeout: 248 seconds]
<eskatrem>
I can do #require "menhirLib";; and then open MenhirLib...
<oni-on-ion>
it works ?
<eskatrem>
no, `open MenhirLib` doesnt give me access to the function mehnir
<oni-on-ion>
you may need to read the menhir docs listed above to use it programmatically like that; i think it was intended as a ocamlyacc replacement on command line
<oni-on-ion>
what programming languages have you used before ?
<oni-on-ion>
"menhir parser.mly" ? i dont know. i've never used menhir myself
<eskatrem>
well that's the thing, there is no such a thing as "menhir parser.mly" (otherwise I would just do it) but the menhir dependencies are specified in the build file
<eskatrem>
in my case:
<eskatrem>
(menhir
<eskatrem>
(modules parser)
<eskatrem>
(flags ("-la" "2"))
<eskatrem>
)
<oni-on-ion>
ah, is it jbuilder or dune ?
<oni-on-ion>
then still, you should run your builder =) ?
<eskatrem>
so what happens when I build the project is (I think): dune (or ocamlbuild) grabs the menhir dependencies the build file, builds the mly file, andonly then compiles the ocaml code which has the menhir dependencies available, and I cannot (dont know how to) reproduce that in the REPL
<eskatrem>
it's built with dune
<oni-on-ion>
yep, makes sense so far
<oni-on-ion>
can dune run the toplev ?
<eskatrem>
hmm no idea
<oni-on-ion>
ah, found it -- try "dune utop"
<eskatrem>
well, I thought it would be easy to call menhir from toplevel, but clearly it's not (I may be stupid but I dont think you are, oni-on-ion), so I will just read the code
<eskatrem>
christ, version 1.4 of dune not supported
<oni-on-ion>
"dune utop ." or "dune utop ./src/ -- -use-menhir" or something
<oni-on-ion>
o_o
<oni-on-ion>
1.9.3 here
<eskatrem>
still, it would be super convenient for me to use the parser from the repl
<eskatrem>
what version of dune do you have? 1.1.1 for me
<oni-on-ion>
eskatrem, heh, im sure it must be possible. we can install pretty printing extensions and all sorts of things in toplevel. its quite nice. just that neither of us has done it yet =)
<oni-on-ion>
1.9.3
<eskatrem>
ok so that's why!
<oni-on-ion>
yep, that would be very convenient. the reason i mentioned earlier "menhir --interpreter" is just in case if not.
<eskatrem>
I am trying to write some symbolic math functions, so I want to be able to use `myfunction (parse "x/x+1")` instead of `myfunction Div (X, Add X (Num 1))`
<oni-on-ion>
yep, well it is easier than how we are trying to do it.
<oni-on-ion>
i dont know The Real Way
<oni-on-ion>
it must be possible. i dont know anyone that knows menhir...
<eskatrem>
well, maybe running utop with -use-menir will work
<oni-on-ion>
"This will simply check your architecture, download and install the proper pre-compiled binary, backup your opam data if from an older version, and run opam init."
kvda has joined #ocaml
<eskatrem>
yeah ok running the script now...
<eskatrem>
oni-on-ion: do you use ocaml professionally?
caltelt_ has quit [Ping timeout: 272 seconds]
<oni-on-ion>
eskatrem, i might soon, have a job interview coming up for it . using it 100% for my personal hobby project
<eskatrem>
oh good luck!
<oni-on-ion>
i hope to be using it professionally, as now it is my favorite language (been researching and studying the last 2yrs on all sort of languages)
<oni-on-ion>
thanks ! =)
gravicappa has joined #ocaml
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kvda has joined #ocaml
<oni-on-ion>
cool -- ocaml's parser will be using menhir in the future
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<eskatrem>
gotta go, thanks for your help and patience, oni-on-ion
<oni-on-ion>
no problem. i hope everything works out! take care
kapilp has quit [Quit: Connection closed for inactivity]
keep_learning_M has quit [Quit: This computer has gone to sleep]
JimmyRcom has joined #ocaml
kvda has joined #ocaml
kvda has quit [Client Quit]
kvda has joined #ocaml
gravicappa has quit [Ping timeout: 244 seconds]
<oni-on-ion>
yay for Cstubs !
oni_on_ion has joined #ocaml
oni-on-ion has quit [Ping timeout: 248 seconds]
zolk3ri has joined #ocaml
eskatrem` has joined #ocaml
ggole has joined #ocaml
eskatrem has quit [Read error: Connection reset by peer]
gahr_ has joined #ocaml
gahr_ has quit [Client Quit]
gahr_ has joined #ocaml
oni_on_ion has left #ocaml [#ocaml]
oni-on-ion has joined #ocaml
gahr has quit [Ping timeout: 258 seconds]
gahr_ is now known as gahr]
gahr] is now known as gahr
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eskatrem` has left #ocaml [#ocaml]
eskatrem has joined #ocaml
<eskatrem>
oni-on-ion: are you still there?
<eskatrem>
I managed to use the parser in utop, I just do (on the command line) "menhir parser.mly", it generates a normal ocaml file parser.ml, that I can load in utop
<oni-on-ion>
i am here for a bit
<oni-on-ion>
hehe. yep, i know.
<oni-on-ion>
i think you didnt see that suggestion several times from multiple users in the chat. ^_^ glad that its working!
kvda has joined #ocaml
<oni-on-ion>
i've almost solved my problem here too; we are having a successful night? =)
<eskatrem>
p[xx
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Haudegen has joined #ocaml
kvda has joined #ocaml
JimmyRcom has quit [Ping timeout: 268 seconds]
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kvda has joined #ocaml
kvda has quit [Client Quit]
stephe has quit [Ping timeout: 276 seconds]
JSharp has quit [Ping timeout: 252 seconds]
rjungemann has quit [Ping timeout: 252 seconds]
rfv has quit [Ping timeout: 244 seconds]
lopex has quit [Ping timeout: 245 seconds]
alexelcu has quit [Ping timeout: 252 seconds]
JSharp has joined #ocaml
JSharp has quit [Max SendQ exceeded]
alexelcu has joined #ocaml
rfv has joined #ocaml
JSharp has joined #ocaml
stephe has joined #ocaml
lopex has joined #ocaml
rjungemann has joined #ocaml
lostman has joined #ocaml
timeless has quit [Ping timeout: 250 seconds]
mgsk has quit [Ping timeout: 252 seconds]
timeless has joined #ocaml
wilfredh has quit [Ping timeout: 250 seconds]
adi________ has quit [Ping timeout: 250 seconds]
mgsk has joined #ocaml
keep_learning_M has joined #ocaml
chenglou has quit [Ping timeout: 252 seconds]
chenglou has joined #ocaml
wilfredh has joined #ocaml
adi________ has joined #ocaml
bytesighs has quit [Ping timeout: 252 seconds]
cbarrett has quit [Ping timeout: 250 seconds]
ggole has quit [Remote host closed the connection]
ggole has joined #ocaml
stephe has quit [Ping timeout: 250 seconds]
bytesighs has joined #ocaml
stephe has joined #ocaml
alexelcu has quit [Ping timeout: 252 seconds]
cbarrett has joined #ocaml
ShalokShalom has joined #ocaml
alexelcu has joined #ocaml
keep_learning_M has quit [Quit: This computer has gone to sleep]
dmiles has quit []
kakadu has joined #ocaml
kapilp has joined #ocaml
mfp has joined #ocaml
Haudegen has quit [Read error: Connection reset by peer]
Haudegen has joined #ocaml
eskatrem has quit [Read error: Connection reset by peer]
eskatrem has joined #ocaml
oni-on-ion has quit [Read error: Connection reset by peer]
dmiles has joined #ocaml
kakadu has quit [Remote host closed the connection]
philtor has quit [Ping timeout: 268 seconds]
Haudegen has quit [Remote host closed the connection]
philtor has joined #ocaml
philtor has quit [Ping timeout: 272 seconds]
lostman has quit [Quit: Connection closed for inactivity]
kapilp has quit [Quit: Connection closed for inactivity]
KeyJoo has joined #ocaml
q9929t has joined #ocaml
eskatrem has quit [Remote host closed the connection]
rwmjones_ is now known as rwmjones
nicoo has quit [Remote host closed the connection]
nicoo has joined #ocaml
two_wheels has joined #ocaml
FreeBirdLjj has joined #ocaml
jgkamat has quit [Read error: Connection reset by peer]
jgkamat has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 268 seconds]
barockobamo has joined #ocaml
KeyJoo has quit [Quit: KeyJoo]
ygrek has joined #ocaml
jbrown has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
barockobamo has quit [Ping timeout: 252 seconds]
manWithN1Name has joined #ocaml
kapilp has joined #ocaml
barockobamo has joined #ocaml
philtor has joined #ocaml
philt has joined #ocaml
q9929t has quit [Quit: q9929t]
philt has left #ocaml [#ocaml]
manWithN1Name has left #ocaml [#ocaml]
barockobamo has quit [Remote host closed the connection]
apaul1729 has joined #ocaml
ziyourenxiang has quit [Ping timeout: 258 seconds]
spew has quit [Quit: Connection closed for inactivity]
Haudegen has quit [Read error: Connection reset by peer]
Serpent7776 has joined #ocaml
<apaul1729>
asking here since i'm having some issues - i'm trying to make edits to the ocaml-variants.4.07.1+flambda package before i install it in a new switch (using opam2). specifically i'm trying to get ocaml to compile with the `-no-graph` flag
<apaul1729>
i've tried a few variations of `opam switch create --empty`, `opam pin add ocaml-variants.4.07.1+flambda`, and editing the `opam` file to include the `-no-graph` flag in the configure command
<apaul1729>
when I try something like this though, opam runs into "unmet availability conditions" because of my pin conflicting with the base compiler (even though nothing's installed in the switch yet?)
<apaul1729>
i know typically you can do `opam pin add -e` to edit a package, but when i try to edit a the ocaml compiler package itself it runs into conflicts when I try to install it into an empty switch
keep_learning_M has joined #ocaml
Jesin has quit [Quit: Leaving]
keep_learning_M has quit [Quit: This computer has gone to sleep]
Jesin has joined #ocaml
jbrown has joined #ocaml
AtumT has joined #ocaml
ShalokShalom has quit [Remote host closed the connection]
Haudegen has joined #ocaml
spew has joined #ocaml
oni-on-ion has joined #ocaml
jao has quit [Ping timeout: 268 seconds]
niklasl has quit [Ping timeout: 268 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
niklasl has joined #ocaml
klntsky has joined #ocaml
ShalokShalom has joined #ocaml
ShalokShalom has quit [Remote host closed the connection]
tane has joined #ocaml
Anarchos has joined #ocaml
dh_work has quit [Remote host closed the connection]
Chobbes has quit [Quit: WeeChat 1.9.1]
gravicappa has quit [Ping timeout: 272 seconds]
apaul1729 has quit [Ping timeout: 258 seconds]
nullifidian_ has joined #ocaml
jbrown has quit [Remote host closed the connection]
nullifidian has quit [Ping timeout: 248 seconds]
kakadu has joined #ocaml
<Anarchos>
Is there a function on bytes to get the index of a substring ?
<companion_cube>
not in the stdlib
<Anarchos>
companion_cube i just need to get the index of "\n\n" : a blank line indicates the end of a command in my server/client communication protocol
<companion_cube>
well I'd suggest CCString.find :p
<Anarchos>
companion_cube i guess i could look for '\n' and compare next character...
<oni-on-ion>
there's a string split somewhere afaik
<companion_cube>
Anarchos: if you're designing the protocol, you can also use a single \n
jao has joined #ocaml
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
Anarchos has joined #ocaml
ShalokShalom has joined #ocaml
ShalokShalom has quit [Remote host closed the connection]
Jesin has quit [Quit: Leaving]
Jesin has joined #ocaml
kapilp has quit [Quit: Connection closed for inactivity]
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
spew has quit [Quit: Connection closed for inactivity]
ggole has quit [Quit: Leaving]
two_wheels has quit [Remote host closed the connection]
dimitarvp has joined #ocaml
wilfredh has quit [Quit: Connection closed for inactivity]
dimitarvp has quit [Client Quit]
ygrek has quit [Ping timeout: 248 seconds]
tane has quit [Quit: Leaving]
Serpent7776 has quit [Quit: leaving]
vsui has joined #ocaml
jbrown has joined #ocaml
manWithNoName has joined #ocaml
manWithNoName has left #ocaml [#ocaml]
zolk3ri has joined #ocaml
kakadu has quit [Remote host closed the connection]
zolk3ri has quit [Remote host closed the connection]
nullifidian_ has quit [Ping timeout: 248 seconds]
vsui has quit [Ping timeout: 258 seconds]
nullifidian_ has joined #ocaml
Jeanne-Kamikaze has joined #ocaml
AtumT has quit [Quit: AtumT]
vsui has joined #ocaml
Haudegen has quit [Ping timeout: 258 seconds]
jbrown has quit [Remote host closed the connection]
apaul1729 has joined #ocaml
apaul1729 has quit [Remote host closed the connection]