Parcom: CL Parser Combinators
https://github.com/fosskers/parcom
#HackerNews #Parcom #CL #Parser #Combinators #HackerNews #Programming #Languages #GitHub
Parcom: CL Parser Combinators
https://github.com/fosskers/parcom
#HackerNews #Parcom #CL #Parser #Combinators #HackerNews #Programming #Languages #GitHub
In about an hour, Adám from Dyalog is appearing on today's Tacit Talk, a podcast about programming languages, combinators, algorithms, and more. Watch live at 14:00 UTC at https://www.youtube.com/watch?v=6LrQithKj8w
#Dyalog #APL #Programming #Combinators #Algorithms #FunctionalProgramming #Podcast #LiveStream #TechTalk #Coding #TechPodcast
Context free grammars (CFG) are better than parsing expression grammars (PEG), because CFGs represent how we think.
Parser combinators are similar to PEGs, so they are worse than CFGs, too.
So, don't use Rust libraries nom
, combine
. Use lalrpop
.
Don't use Haskell libraries parsec
, gigaparsec
, attoparsec
, megaparsec
, trifecta
. Use Earley
, happy
.
See more detailed story in my new article https://safinaskar.writeas.com/this-is-why-you-should-never-use-parser-combinators-and-peg .
The story also includes some cases, where PEG and parser combinators may still be useful. Also, the article gives links to my Haskell parsing libraries.
#haskell #rust #parsing #parse #cfg #peg #combinators #parsercombinators #parsingcombinators #nom #combine #lalrpop #parsec #earley #happy
Given my difficulties to wrap my head around the Y combinator, I expected it to come with a higher run time penalty. 🙂
Clojure Blackbird:
(def sum #(reduce + %))
(def • (comp comp comp))
(def aggregate (• sum map))
(aggregate count [[1 2 3] [1 2 3]])
prettifying my code with combinators tonight :butterfly_ace:
original:
, Tuple "compileParser" $ const $ Right $ assemble >>> case _ of
Left errs -> pure $ Left $ printErrors errs
Right assembled -> compile assembled <#> case _ of
Left errs -> Left $ intercalate "\n" errs
Right result -> Right result
combinatorified:
, Tuple "compileParser" $ noArgs $
assemble >>> do
failing printErrors |||
compile >== (intercalate "\n" +++ identity)
:butterfly_trans:
Neat!
Short article about Schönfinkel's combinator calculus - in Julia!
https://riptutorial.com/julia-lang/example/20334/the-ski-combinator-system
#schonfinkel #combinators #calculus #julialang
Nice post on similarities between #combinators and #stack based #programming
gemini://gemini.rlamacraft.uk/techGuides/stackProgrammingAndCombinators.gmi
I created this cheat sheet about #combinators and their #haskell|-equivalents. Since I didn't find something similiar in my learning process, I thought this could be helpful for others
Examples of binary choices where both options seem equally good at first, but really aren't:
When writing parsers using #parser #combinators, consuming trailing whitespace is better than consuming leading whitespace. "Design patterns for parser combinators" https://dl.acm.org/doi/abs/10.1145/3471874.3472984
When writing #E2E #tests, clearing the database before each test is better than clearing it after. "Dangling state is your friend" https://docs.cypress.io/guides/references/best-practices#Dangling-state-is-your-friend
#Propositions As #Types • 1
• https://inquiryintoinquiry.com/2013/01/29/propositions-as-types-1/
One of my favorite mathematical tricks — it almost seems too tricky to be true — is the #PropositionsAsTypesAnalogy. And I see hints the 2-part analogy can be extended to a 3-part analogy, as follows.
\(\text{proof hint : proof : proposition :: untyped term : typed term : type}\)
See my notes on #PropositionsAsTypes for more.
• https://oeis.org/wiki/Propositions_As_Types_Analogy
#Logic #Combinators #ProofTheory #TypeTheory
#CurryHowardIsomorphism #LambdaCalculus
@tapani the only thing I would have done differently if I was writing it today, I'd use #parser #combinators for https://github.com/manpages/py-ken/blob/master/parser.py, moved program entry point to `main.py` and removed all the dead WIP code like `solver.py`.