<companion_cube>
then your distro should upgrade OCaml?
<olle>
Description: Ubuntu 20.04.5 LTS
<olle>
Meh
<olle>
Trying opam switch
mro has joined #ocaml
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<olle>
00:08.694 CLIENT conflict!
<olle>
Sorry, no solution found: there seems to be a problem with your request.
<olle>
Not my lucky day today
<companion_cube>
create a new switch?
<olle>
I'm already on → 4.14.0 ocaml-base-compiler.4.14.0 4.14.0
<olle>
let d = Seq.to_dispenser (List.to_seq l) in <--- Can someone rewrite this in 4.08 compatible code? ;(
<sim642>
You could just copy the bits from newer stdlib sources
<olle>
Hmmmmm
qwr has quit [Ping timeout: 252 seconds]
<olle>
Checking
<sim642>
Although at that point you might as well skip the Seq
<sim642>
And just write a list_to_dispenser function directly
<olle>
Don't have the skill
<olle>
But I can copy-paste it from src
<sim642>
Would be a good exercise then
<sim642>
to_seq is creating a Seq and to_dispenser is pattern matching it
<sim642>
So the two functions could be fused to avoid going through Seq, just pass the variables directly and inline some code
<olle>
Exercise?
<olle>
I'm not hear to learn! xD
<sim642>
And it will be more efficient because it doesn't allocate all those intermediate objects
<olle>
here*
<companion_cube>
what's a dispenser?
<olle>
My question too lmao
qwr has joined #ocaml
<olle>
Type token Seq.node is not compatible with type 'a node
<olle>
Bound to happen
<sim642>
You don't need to copy the definition of Seq.t
<sim642>
companion_cube, Java-style iterator
<sim642>
a stateful `unit -> 'a`
<olle>
sim642: to_disponser returns Cons, which includes t
<companion_cube>
ah. which library?
<olle>
dispenser*
<sim642>
companion_cube, the standard one :D
<sim642>
My bad, it's `'a option` at the end, but the idea is the same
<companion_cube>
ahhhhh yes, it's the newer Seq functions. I forgot François had picked this name.
<companion_cube>
I call this "gen".
<sim642>
olle, I guess you could use to_gen from oseq then as well
<sim642>
I looked at the docs quickly before and didn't see to_dispenser so I thought it didn't have that
mro has quit [Remote host closed the connection]
mro has joined #ocaml
<olle>
sim642: does oseq consume a list?
<olle>
OSeq.from_list
<olle>
of_list perhaps
<olle>
Yep
bartholin has quit [Quit: Leaving]
<olle>
Meh, piece still not fitting together, with the second parser
<olle>
So hard
mro has quit [Remote host closed the connection]
mro has joined #ocaml
<olle>
Hm hm
<companion_cube>
tbh, just parse the comment as a string, and parse it later
<companion_cube>
it'll be 10× simpler
Anarchos has joined #ocaml
<olle>
companion_cube: Yes, started to think about alternatives... :d Like hard-coding the few grammar rules in the lexer instead
<olle>
But now it runs... Just have to tune the grammar
dstein64- has joined #ocaml
<olle>
Also, pretty cool to know how to piece together multiple DSL :D
<olle>
Ya of course the grammar is incorrect :d
<olle>
I hate that it can't be debugged, like "you gave me token stream x but I expected y"
dstein64- has quit [Client Quit]
dstein64 has quit [Ping timeout: 252 seconds]
dstein64 has joined #ocaml
<olle>
Getting "option is None", so maybe the token provider didn't work exactly :|
<olle>
Another alternative is to add state, like state = Inside_docblock, which changes the lexer behaviour
<olle>
Yet another, to write the parsing of the token stream manually, without the mly file
<olle>
2 | (libraries base stdio str re dolog expect_test_helpers_kernel oseq menhir) ^^^^^^
<olle>
Error: Library "menhir" not found.
<olle>
olle@olle-GP60-2PF-Leopard-Pro:~/kod/pholyglot/src$ opam list | grep menhir
<olle>
menhir 20220210 An LR(1) parser generator
<olle>
It's installed x.x
sagax has quit [Remote host closed the connection]
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
<olle>
companion_cube: Oh, maybe you mean, save as a string, and then apply a completely separate lexer+parser on-demand in the compiler during, say, inference? Might be easier...
Haudegen has joined #ocaml
<olle>
No wiat
<olle>
Now I get it xD
sagax has joined #ocaml
waleee has joined #ocaml
Anarchos has quit [Quit: Vision[]: i've been blurred!]
bobo_ has quit [Ping timeout: 246 seconds]
spip has joined #ocaml
<olle>
Hm, how do I tell ocamllex to eat all chars until the string "*/"? [^ '*'] only works for single chars :d
<olle>
Oh, maybe just 47 | "/**" (digit|nondigit)* as s "*/" { DOCBLOCK_AS_STR s }
<olle>
is enough
<olle>
or _*
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
Haudegen has joined #ocaml
Anarchos has joined #ocaml
Anarchos has quit [Ping timeout: 265 seconds]
<olle>
Alright, got a working solution with two seperate lexer/parser systems
<olle>
\o/
<olle>
Now I can sleep
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
Haudegen has joined #ocaml
Anarchos has joined #ocaml
Serpent7776 has quit [Ping timeout: 268 seconds]
dnh has joined #ocaml
olle has quit [Ping timeout: 250 seconds]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]