companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 4.14.0 released: https://ocaml.org/releases/4.14.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
bobo_ has joined #ocaml
spip has quit [Ping timeout: 245 seconds]
rgrinberg has joined #ocaml
williewillus_ has joined #ocaml
Haudegen has quit [Ping timeout: 252 seconds]
troydm has quit [Quit: What is Hope? That all of your wishes and all of your dreams come true? To turn back time because things were not supposed to happen like that (C) Rau Le Creuset]
troydm has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
John_Ivan has quit [Quit: Leaving]
deadmarshal has quit [Ping timeout: 268 seconds]
deadmarshal has joined #ocaml
rgrinberg has joined #ocaml
chrisz has quit [Ping timeout: 252 seconds]
chrisz has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
williewillus_ has quit [Quit: Leaving]
rgrinberg has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
azimut has joined #ocaml
alivenotions has joined #ocaml
alivenotions has left #ocaml [#ocaml]
zebrag has quit [Remote host closed the connection]
dnh has joined #ocaml
azimut has quit [Ping timeout: 268 seconds]
<greenbagels> hmm im parsing data line-by-line from a flat text file and trying to json-format it
<greenbagels> is there a general preference for whether i should try to first map the data to like, records and then use atdgen to turn it into json-serialized data, or just stuff it into yojson's json polymorphic variant type as im reading?
<greenbagels> because i feel like the number of matches / `Assoc [(key, val); ...] is getting kind of cumbersome, but i think this might be indicative of an issue i'd run into with my parsing rather than what libraries im using...
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
omegatron has joined #ocaml
Tuplanolla has joined #ocaml
Anarchos has joined #ocaml
<Anarchos> Is there an ocaml equivalent of htonl/ntohl integer conversions for network read/write ?
adanwan has quit [Ping timeout: 268 seconds]
adanwan_ has joined #ocaml
Serpent7776 has quit [Quit: leaving]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
bartholin has joined #ocaml
hippoid has quit [Quit: WeeChat 3.5]
nore has quit [Ping timeout: 240 seconds]
nore has joined #ocaml
omegatron has quit [Quit: Power is a curious thing. It can be contained, hidden, locked away, and yet it always breaks free.]
<companion_cube> Just use Bytes.get_int32_{le,be}
<companion_cube> And the likes
<companion_cube> greenbagels: you want to emit a list of json, or just a single json object?
jpds has quit [Remote host closed the connection]
jpds has joined #ocaml
Haudegen has joined #ocaml
omegatron has joined #ocaml
John_Ivan has joined #ocaml
azimut has joined #ocaml
bobo_ has quit [Read error: Connection reset by peer]
bobo_ has joined #ocaml
hyphen has quit [Ping timeout: 240 seconds]
hyphen has joined #ocaml
romildo has joined #ocaml
hyphen has quit [Ping timeout: 268 seconds]
romildo has quit [Client Quit]
hyphen has joined #ocaml
hyphen has quit [Ping timeout: 245 seconds]
hyphen has joined #ocaml
hyphen has quit [Ping timeout: 245 seconds]
hyphen has joined #ocaml
hyphen has quit [Ping timeout: 268 seconds]
hyphen has joined #ocaml
hyphen has quit [Ping timeout: 240 seconds]
hyphen has joined #ocaml
zebrag has joined #ocaml
azimut has quit [Remote host closed the connection]
<greenbagels> companion_cube: single object
<companion_cube> Probably easier to make a big yojson object then
<companion_cube> Or jsonm stream of tokens if you need better perf?
<greenbagels> ok ill keep playing around with yojson until i find a program structure that doesnt feel awkward :~)
<greenbagels> polymorphic variants are cool
orbifx has joined #ocaml
kakadu has quit [Remote host closed the connection]
<companion_cube> Maybe use combinators? :p
<sim642> companion_cube, "your" catapult library is nice, but too bad it doesn't let me make up thread IDs (and give them custom names) to have separate tracks in Perfetto
hyphen has quit [Ping timeout: 252 seconds]
hyphen has joined #ocaml
hyphen has quit [Ping timeout: 268 seconds]
hyphen has joined #ocaml
azimut has joined #ocaml
<orbifx> sim642: can you not form our own maps?
<sim642> orbifx, hm?
<orbifx> can you not have a map: your id -> catapult id ?
<sim642> That's not really the issue. Rather the file format has a way to associate names to thread numbers, but the library API doesn't allow doing that arbitrarily
<sim642> And I want my custom names in the produced file so it'd show up in all the tooling that reads those files
<companion_cube> sim642: it should? Hmm
<companion_cube> It captures thread ids automatically
<companion_cube> And process ids. But you can provide these by hand
<sim642> yeah, but I don't want it to capture tids automatically
<sim642> And if I manually pass a tid, then it only works if that's actually the right one
<sim642> and fails an assert if it isn't
<companion_cube> Oh, interesting. What's the use case? It can be changed I rink
<companion_cube> Think
<sim642> Right now I just hacked around it by using a fake pid instead, but I cannot name it still
<sim642> The use case is that I want a separate track of nested durations
<companion_cube> Hmm there is a meta event to name it
<companion_cube> Hmm you sure you don't want async events?
<sim642> I want the normal track to have the normal tracing stuff, but then a secondary track that visualizes the stack of the program under (static) analysis
<companion_cube> Do you know how to do it if you produce the json by hand?
<companion_cube> Oh, you're saying it's just using a fake thread id. Interesting.
<sim642> Maybe? I don't know because I didn't really understand all the business with asyncs and flows
<companion_cube> Please open an issue, it can easily be accommodated :).
<companion_cube> Yeah I've used them only a little and with the chrome viewer, not perfetto
<sim642> Another thing I was wondering is the possibility of using multiple backends at once
<companion_cube> As an aside I also love Tracy with its importer.
<companion_cube> Oh?
<sim642> Like the normal json file one and another custom one that does some aggregation on the go for a landmarks style printout also
<companion_cube> Maybe with a multiplexer. But please tell, it's probably doable.
<companion_cube> Nice
szkl has quit [Quit: Connection closed for inactivity]
<companion_cube> Producing a landmark file from the raw json might be possible, too. It's an interesting question.
<sim642> I didn't investigate it too much, but that's some generic CTF stuff that might already exist somewhere
<sim642> Especially given all the Perfetto stuff besides the UI
<sim642> And all the SQL-whatever in the UI as well
<sim642> I don't yet know for sure, what and how far I'd want to take, but I was just looking for more modern and powerful replacements for CIL's old Stats module...
<sim642> Which is like 20 years old landmarks, without any of the bells and whistles
<companion_cube> What's CIL ?
<companion_cube> But yeah, I'm open to improving things!!
<sim642> It's an ancient C parser/frontend library in ocaml
<companion_cube> Oh right.
<sim642> I also found that dune publishes the chrome-trace package, which is more low level and just for constructing the json output with no restrictions
<sim642> But it collects all the events in memory so it can output them inside a CTF object
<sim642> I'm guessing all users of that library are internal?
<companion_cube> Yep
<companion_cube> (well tbh it's mostly me)
adanwan_ has quit [Remote host closed the connection]
adanwan has joined #ocaml
orbifx has quit [Quit: WeeChat 3.4]
xgqt has quit [Ping timeout: 245 seconds]
xgqt has joined #ocaml
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
Haudegen has joined #ocaml
adanwan has quit [Read error: Connection reset by peer]
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
adanwan has joined #ocaml
bobo_ has quit [Quit: Konversation terminated!]
Tuplanolla has quit [Quit: Leaving.]
spip has joined #ocaml
bartholin has quit [Quit: Leaving]
John_Ivan has quit [Read error: Connection reset by peer]
John_Ivan has joined #ocaml
nvaxplus has joined #ocaml
<nvaxplus> Got a menhir question (well I suppose it's somewhat of a LR(1) question). Suppose I have a language where you can have named function arguments like python syntax (`foo(regular, named = quux)`). Naively trying to write this in menhir produces shift/reduce conflicts. Is that syntax simply not in LR(1) or am I doing it wrong? (Or does Menhir have any workarounds)
<dh`> I haven't thought about it for more than five seconds but most likely you're doing it wrong
<dh`> in general with grammars there are lots of ways to express thngs and most of them don't work, same as how with most languages there are lots of things you can type and most of them are syntax errors :-)
<nvaxplus> yeah I figure I am doing it wrong, but having a mental freeze where I can think of how to paraphrase it right
<dh`> I just hacked up a quick test and it works fine
<dh`> most likely source of trouble is that ':' appears in your expression syntax somewhere
<nvaxplus> hmm why do you say?
<dh`> because if expr | IDENT COLON expr is ambiguous the most likely reason is that IDENT COLON is a valid prefix of expr
<dh`> such that it can't disambiguate those cases
<nvaxplus> hmm I see
rgrinberg has joined #ocaml
<nvaxplus> dh`: do you mind pastebinning what you wrote?
<dh`> yeah was about to, need to make it tidy first
<dh`> what's a good pastebin here?
<dh`> actually n/m
<nvaxplus> thank you so much! and no worries about tidiness!
<dh`> now it actually compiles :-)
<nvaxplus> dh`: thank you!!!
<dh`> yw
<dh`> grammar stuff is very highly stylized and it takes practice to be fluent with it, few people ever bother IME
<dh`> nearly every published grammar you'll find will be ambiguous and most yacc grammars in production are full of both conflicts and ad hoc disambiguation rules