companion_cube changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.11 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.11/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
rig0rmortis has quit [Quit: beep boop]
sonologico has quit [Remote host closed the connection]
borne has quit [Ping timeout: 260 seconds]
ransom has joined #ocaml
sagax has joined #ocaml
rock64 has quit [Ping timeout: 260 seconds]
rock64 has joined #ocaml
lnxw37d4 has quit [Ping timeout: 244 seconds]
flux has quit [Ping timeout: 240 seconds]
ansiwen[m] has quit [Ping timeout: 240 seconds]
peddie has quit [Ping timeout: 244 seconds]
xzax_[m] has quit [Ping timeout: 240 seconds]
talyian[m] has quit [Ping timeout: 260 seconds]
Manis[m]11 has quit [Ping timeout: 244 seconds]
rwmjones has quit [Ping timeout: 244 seconds]
rwmjones has joined #ocaml
xzax_[m] has joined #ocaml
talyian[m] has joined #ocaml
Manis[m]11 has joined #ocaml
flux has joined #ocaml
lnxw37d4 has joined #ocaml
ansiwen[m] has joined #ocaml
peddie has joined #ocaml
proletkultura has quit [Ping timeout: 246 seconds]
_whitelogger has joined #ocaml
mfp has quit [Ping timeout: 240 seconds]
laokz has joined #ocaml
spew has quit [Quit: Connection closed for inactivity]
_whitelogger has joined #ocaml
osa1 has joined #ocaml
snowpanda has joined #ocaml
mmohammadi9812 has joined #ocaml
narimiran has joined #ocaml
reynir has quit [Ping timeout: 258 seconds]
reynir has joined #ocaml
waleee-cl has quit [Quit: Connection closed for inactivity]
sagax has quit [Quit: Konversation terminated!]
<vsiles> I just stumbled upon this piece of code:
<vsiles> let n =
<vsiles> if len > Int.max_value then
<vsiles> Int.max_value
<vsiles> else
<vsiles> len
<vsiles> in
<vsiles> is the len > Int.max_value test a valid one ?
andreas303 has quit [Remote host closed the connection]
Serpent7776 has joined #ocaml
laokz has quit [Ping timeout: 240 seconds]
nullcone has quit [Read error: Connection reset by peer]
nullcone has joined #ocaml
andreas303 has joined #ocaml
<def> no
<def> I wonder what they had in mind ?!!
<def> as far as I know, this can never evaluates to true.
<d_bot> <ostera> did you mean to compare `n > n + x` ?
sagax has joined #ocaml
laokz has joined #ocaml
decentpenguin has quit [Read error: Connection reset by peer]
chripell_ has quit [Quit: ZNC 1.8.1+deb1 - https://znc.in]
decentpenguin has joined #ocaml
osa1 has quit [Ping timeout: 256 seconds]
<vsiles> @ostera not my code, I'm updating a code base and stumbled upon that. Will escalate with the other authors
dckc has quit [Ping timeout: 256 seconds]
mbuf has joined #ocaml
Haudegen has joined #ocaml
rpcope has quit [Ping timeout: 265 seconds]
dckc has joined #ocaml
<d_bot> <ostera> +1
mmohammadi9812 has quit [Ping timeout: 258 seconds]
borne has joined #ocaml
rpcope has joined #ocaml
chripell has joined #ocaml
bartholin has quit [Quit: Leaving]
laokz has quit [Ping timeout: 240 seconds]
snowpanda has quit [Quit: Leaving...]
dhil has joined #ocaml
mbuf has quit [Ping timeout: 240 seconds]
Haudegen has quit [Quit: Bin weg.]
Haudegen has joined #ocaml
osa1 has joined #ocaml
proletkultura has joined #ocaml
Anarchos has joined #ocaml
proletkultura has quit [Ping timeout: 240 seconds]
olle has joined #ocaml
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
vicfred_ has joined #ocaml
vicfred has quit [Ping timeout: 272 seconds]
<def> could be a safety check to validate assumptions... even then it seems weird.
dhil has quit [Ping timeout: 265 seconds]
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
osa1 has quit [Remote host closed the connection]
osa1 has joined #ocaml
rwmjones has quit [Ping timeout: 246 seconds]
osa1 has quit [Client Quit]
osa1 has joined #ocaml
<vsiles> the guy's in the US, so waiting for the timezone lag to apply:D
dhil has joined #ocaml
mfp has joined #ocaml
rwmjones has joined #ocaml
sonologico has joined #ocaml
rwmjones has quit [Ping timeout: 240 seconds]
rwmjones has joined #ocaml
rwmjones_ has joined #ocaml
Tuplanolla has joined #ocaml
rwmjones has quit [Ping timeout: 240 seconds]
Haudegen has quit [Quit: Bin weg.]
laokz has joined #ocaml
<d_bot> <EduardoRFS> there is any good way to know in which rule menhir is when using the incremental API? I want to do lookahead
rwmjones_ has quit [Ping timeout: 264 seconds]
webshinra has quit [Remote host closed the connection]
webshinra has joined #ocaml
rwmjones has joined #ocaml
narimiran has quit [Ping timeout: 240 seconds]
Anarchos has joined #ocaml
Haudegen has joined #ocaml
mfp has quit [Remote host closed the connection]
ggole has joined #ocaml
laokz has quit [Ping timeout: 272 seconds]
sagax has quit [Remote host closed the connection]
laokz has joined #ocaml
waleee-cl has joined #ocaml
sagax has joined #ocaml
<def> Erf. You can query the kernel with the introspection API.
<def> But this is far from trivial, you need to know a bit of LR.
proletkultura has joined #ocaml
def has quit [Remote host closed the connection]
def has joined #ocaml
<vsiles> Is it possible to mix when and multiple patterns ? Like in `let f = function A x when g x | B _ -> print_endline "Some A and B" | _ -> print_endline "the rest"` ?
<def> No
ransom has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<def> The when is part of the branch syntax `<pattern> [when expr] -> expr`, not pattern syntax.
<def> If you want to achieve that, the best is probably to factor out the branch action in a local function and use two cases.
reynir1 has joined #ocaml
<vsiles> my guess too, thanks for the confirmation
reynir has quit [Disconnected by services]
reynir1 is now known as reynir
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
<d_bot> <EduardoRFS> def: any clue? I've been looking on the Inspection API for an hours now,
proletkultura has quit [Ping timeout: 260 seconds]
<d_bot> <Def> @EduardoRFS switching to discord because the bot is annoying.
<d_bot> <Def> So... What are you trying to achieve exactly (I am working on a related problem at the moment)?
<d_bot> <EduardoRFS> I'm just trying to separate nested selectors in CSS,
<d_bot> <EduardoRFS>
<d_bot> <EduardoRFS> ```css
<d_bot> <EduardoRFS> body {
<d_bot> <EduardoRFS> div:active;
<d_bot> <EduardoRFS> div:active { color: red; }
<d_bot> <EduardoRFS> }
<d_bot> <EduardoRFS> ```
<d_bot> <EduardoRFS> it seems like should be possible without lookahead tho
<d_bot> <EduardoRFS> if it do `{` before a `}` or a `;` it's a rule, otherwise it's a CSS declaration
<d_bot> <Def> ah.
<d_bot> <Def> nested rules, not nested selector?
<d_bot> <EduardoRFS> right
<d_bot> <Def> This seems to be expressible in LR(1). It would be easier by looking at the grammar, but a priori I don't recommend looking at parser state to solve this issue.
<d_bot> <EduardoRFS> it is, but the CSS spec doesn't follow LR(1) and ideally I would be able to keep implementing following the spec
<d_bot> <EduardoRFS> of course this isn't part of CSS, but it should behave as normal CSS
<d_bot> <Def> can you share your grammar?
<d_bot> <EduardoRFS> @Def the simplified version, with the hack that I was trying to achieve
<d_bot> <EduardoRFS>
ransom has joined #ocaml
<d_bot> <Def> what is the hack?
<d_bot> <EduardoRFS> if it's in the right state, it emits `NEXT_IS_DECLARATION` or `NEXT_IS_RULE`
<def> ok
<d_bot> <EduardoRFS> but couldn't figure it out a why to see if it's in the right state
laokz has quit [Ping timeout: 240 seconds]
<def> do you really need the whitespace rules?
<def> If you remove the whitespace, you remove the conflict. Or if you add whitespaces to RULE too.
<d_bot> <EduardoRFS> hmmmm
<def> removing the whitespace is clearly the right solution. Whitespaces are generally a big source of ambiguities
<def> (Because they can attach at many places in the derivation... And since they are semantically irrelevant it is preferable to get rid of them as soon as possible)
<d_bot> <EduardoRFS> yeah but the problem is deeper than that, CSS uses whitespace for some magic for a long time now, and as you can see, the spec defines how to handle whitespaces
<d_bot> <EduardoRFS>
<def> What is whitespace used for?
<def> I can see that they put explicit whitespace in their grammatical specification, but I don't see where they affect parsing.
<d_bot> <EduardoRFS> some of the properties grammars will use whitespace to have the separation between two tokens together, I don't remember by head but there is some cases, and it's not simple to find them, nowadays is more than 200 CSS properties
<Armael> something I did once to deal with whitespace-related hacks (in the mustache parser) is to have some hand-written code that runs between the lexer and the parser
<d_bot> <EduardoRFS> yeah that's my idea, but for that I need to inspect the menhir state and that doesn't seems to be simple
<def> Ok.
<Armael> (what I'm talking about didn't require inspecting the menhir state: I just write a function taking a list of tokens and producing a list of tokens)
<Armael> wrote*
nkly has joined #ocaml
<d_bot> <EduardoRFS> I can do that actually, just by tracking `{, }, ;`
<d_bot> <EduardoRFS> that seems like an easier thing to implement
laokz has joined #ocaml
<Armael> (I don't remember what it does exactly, though)
laokz has quit [Remote host closed the connection]
laokz has joined #ocaml
<def> if you refactor the grammar such that the no reduction happens before seeing the { you will avoid conflicts
<def> note that it seems you are already missing some whitespace tokens.
<def> also, prefers using whitespace-token? to whitespace-token*, the former is less ambiguous, requires less lookahead (in the LR sense), and is semantically equivalent
proletkultura has joined #ocaml
<def> (since a whitespace-token already represents a nonempty list of whitespace codepoints)
<def> (what you probably want in your case it rewrite the selector specification in "destination passing style": you want to shift as many tokens as possible before reducing)
<def> (shifting is fine in an LR parser as it delays decisions, reducing forces to choose one option)
<d_bot> <EduardoRFS> nice with_loc trick
<d_bot> <EduardoRFS> yeah I agree on the using single whitespace vs lisp() the problem is for some weird reason the spec keeps saying "while WHITESPACE skip", but I can easily normalize it anyway
<def> The spec distinguishes whitespace and whitespace-token, look closely at the wording.
<def> whitespace is literally an input character.
<def> whitespace-token is the non-empty list of of whitespace characters.
<def> As soon as you are at the token level, it no longer mentions lists.
<d_bot> <EduardoRFS> the parsing spec always refer to tokens, on 5. is only token
<d_bot> <EduardoRFS> 5.3.8
<d_bot> <EduardoRFS> `While the next input token from input is a <whitespace-token>, consume the next input token from input`
<def> Ah. They just like to add ambiguities. But don't bother, it is semantically equivalent, you just remove an ambiguity from the spec.
proletkultura has quit [Ping timeout: 265 seconds]
dckc has quit [Ping timeout: 240 seconds]
dckc has joined #ocaml
<d_bot> <EduardoRFS> thanks on not using the whitespace*, I knew that it wasn't needed but thought it wouldn't cause any problem
olle has quit [Ping timeout: 240 seconds]
<vsiles> def: the code I asked about this morning (i > max_int) was outsourced to ocamlpro
<vsiles> not very pro if you ask me :D
def has quit [Remote host closed the connection]
def has joined #ocaml
laokz has quit [Quit: Leaving]
borne has quit [Ping timeout: 244 seconds]
spew has joined #ocaml
hnOsmium0001 has joined #ocaml
proletkultura has joined #ocaml
ransom has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ransom has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
troydm has quit [Ping timeout: 264 seconds]
bartholin has joined #ocaml
troydm has joined #ocaml
dhil has quit [Ping timeout: 240 seconds]
motherfsck has quit [Quit: quit]
proletkultura has quit [Ping timeout: 256 seconds]
Haudegen has joined #ocaml
proletkultura has joined #ocaml
osa1 has quit [Ping timeout: 240 seconds]
vicfred_ has quit [Quit: Leaving]
ransom has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dhil has joined #ocaml
ransom has joined #ocaml
ransom has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
narimiran has joined #ocaml
ransom has joined #ocaml
ggole has quit [Quit: Leaving]
vicfred has joined #ocaml
ransom has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
snowpanda has joined #ocaml
ransom has joined #ocaml
proletkultura has quit [Ping timeout: 240 seconds]
jnavila has joined #ocaml
bacam has quit [Quit: reboot]
bacam has joined #ocaml
chripell has quit [Quit: ZNC 1.8.1+deb1 - https://znc.in]
proletkultura has joined #ocaml
chripell has joined #ocaml
tane has joined #ocaml
amiloradovsky has joined #ocaml
borne has joined #ocaml
<proletkultura> just stopping by to again say as an ocaml noob the whole opam ecosystem is just a dream to work with. i havent had to dig into things once and i've been working in ocaml for a month straight. its just this magic black box that you opam do this and it does it, seemingly every time. i don't think i've ever had that kind of quality experience dealing with packages before. the bizzare thing is that you
<proletkultura> think, from a distance, ocaml must be full of out of date things i need that i will have to fix myself. But its the opposite, a small set of packages that are very well maintained. bravo again y'all, opam is something good in a world where very little can lay stakes to that claim.
reynir has quit [Ping timeout: 272 seconds]
reynir has joined #ocaml
proletkultura has quit [Ping timeout: 256 seconds]
proletkultura has joined #ocaml
ransom has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
narimiran has quit [Ping timeout: 240 seconds]
amiloradovsky has quit [Remote host closed the connection]
amiloradovsky has joined #ocaml
retropikzel has joined #ocaml
ransom has joined #ocaml
jnavila has quit [Quit: Konversation terminated!]
retropikzel has quit [Quit: Leaving]
reynir has quit [Ping timeout: 240 seconds]
reynir has joined #ocaml
Jesin has quit [Quit: Leaving]
Jesin has joined #ocaml
Serpent7776 has quit [Quit: leaving]
proletkultura has quit [Ping timeout: 258 seconds]
ransom has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ransom has joined #ocaml
<d_bot> <beheddard> Just ran into a weird bug/issue. I've trying out JaneStreet core for the fire time (usually just use Base), and the Print module functions are not actually printing anything to standard out
tane has quit [Quit: Leaving]
andreas303 has quit [Remote host closed the connection]
andreas303 has joined #ocaml
andreas303 has quit [Remote host closed the connection]
andreas303 has joined #ocaml
sonologico has quit [Remote host closed the connection]
Haudegen has quit [Ping timeout: 240 seconds]
dhil has quit [Ping timeout: 264 seconds]