companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.2.0 released: https://ocaml.org/releases/5.2.0 | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
Tuplanolla has quit [Quit: Leaving.]
<discocaml> <._null._> Just to be sure, Pratt parsing is completely subsumed by menhir, it can just be much more annoying to write in menhir, right ? The only definite advantage I know of Pratt parsing is for variable precedence operators
<discocaml> <contificate> I don't think it is subsumed by Menhir
<discocaml> <contificate> Haskell is famously parsed by a LALR(1) parser generator but, as you mention, it has user-defined precedence and requires a tree fixup pass (akin to Pratt's algorithm) in the compiler
<discocaml> <contificate> so there's variable and also dynamic, in that you could parameterise the parser with different precedences and basically emulate a GLR parser in some contexts
<discocaml> <contificate> so there's variable and also dynamic, in that you could parameterise the parser with different precedences and basically emulate what a GLR parser may succeed to parse in some fork of the parser in some contexts
<discocaml> <contificate> ignoring any formal arguments about how powerful LR(1) parsing is, there's no doubt it's tedious, difficult to maintain, difficult to debug, difficult to find people skilled enough to contribute effectively, etc.
<discocaml> <contificate> and that's not even citing the weak arguments you usually get which concern error recovery and error messages, which Menhir can deal with decently
<discocaml> <._null._> Disregarding parsing power, I want a tool which prevents me from resolving conflicts unknwoingly
<discocaml> <contificate> I like Pratt parsing, it's like you're defining a step-wise semantics for the parser, in the fairly obvious way: each left denotation is asking what you do when encountering a token, given some "left" you've already parsed etc.
<discocaml> <contificate> I think coverage is all you need
<discocaml> <._null._> Is that testing ? I prefer formal proofs
Frostillicus_1 has joined #ocaml
myrkraverk_ has quit [Read error: Connection reset by peer]
<discocaml> <contificate> unfortunate, I find tests cheaper and more plentiful and more viable
<discocaml> <contificate> would you consider translation validaton as sufficient
<discocaml> <contificate> that's how compcert works in certain parts, right? its register allocation algorithm itself isn't proved correct, its output is verified to be correct w.r.t the constraints it determines
<discocaml> <contificate> would you consider translation validation as sufficient
<discocaml> <._null._> I don't care if the generator is proven correct, only about its output if that's your question
<discocaml> <._null._> But the generator should be able to take a grammar and some disambiguation hints as inputs and output a sound parser
<discocaml> <._null._> or fail if the disambiguation hints aren't sufficient
<discocaml> <contificate> yes, but how many yaks do you want to shave to determine those hints
<discocaml> <contificate> I appreciate the ideal, but my main gripe is purely with "just use menhir" polling results, with no nuance about what you're using it for, the inherent learning curve of LR parsing, etc.
<discocaml> <contificate> if you are happy to spend a lot of time and energy and master the fine arts of LR grammar design and disambiguation, great - I feel I got quite close and then just got tired of it
<discocaml> <._null._> What is "LR grammar design" ? What LR is it ? I would believe it's all about the disambiguation
<discocaml> <._null._> Then the disambiguation has to be improved, I won't deny it
<discocaml> <contificate> well, you have to massage grammars to make them compatible with these tools
<discocaml> <contificate> if you look at basically any grammar online, it's not suitable for generation by any parser generator
<discocaml> <contificate> like https://people.mpi-sws.org/~rossberg/sml.html this purely for human consumption, as it expresses the important rules, SML grammars for mlyacc have to be structured in various ways to work
<discocaml> <contificate> the "grammar design" is factoring a naive grammar in your head to use these generators efficiently
<discocaml> <contificate> which takes a good amount of time and energy to acquire the skillset
<discocaml> <._null._> I might be completely lost, but if you gave this grammar as is to menhir, it would only complain about shift/reduce and reduce/reduce conflicts right ? And if you somehow explain how to resolve all of these conflicts, you'd get your desired parser ?
<discocaml> <contificate> yes, but it's not just finding a set of directives that would just work
<discocaml> <contificate> you'd need to factor it
<discocaml> <contificate> so you'd transform the grammar in a way that requires a lot of care
<discocaml> <._null._> Why do you need to change the grammar?
<discocaml> <contificate> because `expr -> expr expr` is a nonsense
<discocaml> <._null._> Only if you don't explain the conflicts it creates
<discocaml> <contificate> you'd get hundreds of errors
<discocaml> <._null._> resolve*
<discocaml> <._null._> Already by making it so that this rule is always reduced, you'd solve many conflicts
<discocaml> <contificate> fixing a grammar is much harder than building it up incrementally and documenting the problems you've skirted over, as people do
<discocaml> <contificate> like fixing this grammar would be akin to basically boiling it down and building it from scratch
<discocaml> <._null._> What I want is the tool that tells me how it's broken
<discocaml> <contificate> with AI, the future may be bright, we could throw deep learning at our vibecoded garbage
<discocaml> <contificate> tell our customers in the automotive industry that we're sure of its correctness because it routinely passes the "factorial function" test on the nightly test suite
Frostillicus_1 has quit [Ping timeout: 248 seconds]
<discocaml> <tornato> Just vibe code Why3
<discocaml> <contificate> sorry, I only do things that increase shareholder value
<discocaml> <cod1r> hmmmm
<discocaml> <cod1r> HRMMMM
bartholin has quit [Remote host closed the connection]
algm has quit [Remote host closed the connection]
myrkraverk has joined #ocaml
Frostillicus_1 has joined #ocaml
ygrek has quit [Remote host closed the connection]
Humean has joined #ocaml
wingsorc has quit [Remote host closed the connection]
Frostillicus_1 has quit [Ping timeout: 245 seconds]
Frostillicus_1 has joined #ocaml
Frostillicus_1 has quit [Ping timeout: 252 seconds]
myrkraverk_ has joined #ocaml
myrkraverk has quit [Ping timeout: 245 seconds]
spynxic has quit [Read error: Connection reset by peer]
spynxic has joined #ocaml
spynx has joined #ocaml
spynx has quit [Client Quit]
spynx has joined #ocaml
spynxic has quit [Ping timeout: 245 seconds]
spynx has quit [Remote host closed the connection]
spynxic has joined #ocaml
_whitelogger has joined #ocaml
_whitelogger has joined #ocaml
Frostillicus_1 has joined #ocaml
Humean has quit [Ping timeout: 248 seconds]
semarie has quit [Quit: quit]
_whitelogger has joined #ocaml
semarie has joined #ocaml
Frostillicus_1 has quit [Remote host closed the connection]
bartholin has joined #ocaml
Boarders_____ has quit [Quit: Connection closed for inactivity]
wbooze has quit [Quit: Leaving]
wbooze has joined #ocaml
chiselfuse has quit [Remote host closed the connection]
chiselfuse has joined #ocaml
infinity0 has quit [Ping timeout: 276 seconds]
infinity0 has joined #ocaml
myrkraverk has joined #ocaml
myrkraverk_ has quit [Ping timeout: 252 seconds]