Hacker Newsnew | past | comments | ask | show | jobs | submit | maxrovertsb's commentslogin

It's nice that they are being transparent about it.


What is TikTok's algorithm? I am not familiar with the app.


You test out new links with very few people and expand or demote based on the results of the first couple of testers. Pretty sure a bunch of social media, youtube, etc do something similar.


What advantage does a parser generator provide over a parser combinator library like nom?


It's harder to express complex grammars in combinator form.

Combinators excel best for relatively simply regular languages (eg., json, html, etc.).

Languages with lots of "modality" in parsing, ie., context switching, are easier to express in generator-form (eg., antlr).


Wouldn't the mode be encoded in the type system via the tokens your parser is generating? I mean, every mode would be a different enum containing all the tokens that are valid in that mode?


Sure, I imagine it's possible to express any parser-generator grammar in combinator form. It's just a question of how easy it is to do by hand, and how efficient the parsing process would be.


One of the main differences is that LALR parsers don't use backtracking to implement "choice". Parsing happens in a single pass over the input. With parser combinators, ambiguity is silently resolved by accepting the first option that the parser tries. Bottom up LR parsers also do a better job of dealing with left recursion, compared to top down parsers. If you want to parse something using a recursive descent parser (or combinators) you may need to rephrase the grammar to avoid left recursion.

Some of the main downsides of LR parsers are that you need to use a parser generator and you have to know how to resolve possible shift/reduce conflicts. It's more complicated than top down parser, which is just a bunch of regular recursive functions.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: