It's fun to play with #lexers and #parsers to find the best approach for the specific task, continuously morphing between concepts until the right combination of trade-offs is reached.
Last time we lexed +=, so this time we can parse it!
Whatay wonderful #list for anyone interested in #PLDI or #compilers 👌🏽:
“Writing That Changed How I Think About PL”, Max Bernstein (https://bernsteinbear.com/blog/pl-writing/).
Via Lobsters: https://lobste.rs/s/v2zmv3/writing_changed_how_i_think_about_pl
This is why I'm partial to Parslet as my go-to parser library. No generating files, no filling in missing methods, just write your rules and go.
https://kschiess.github.io/parslet/
💪 Thoughts on DuckDB's Grammar Patching Thing (... I dream of parser generators with the sharp edges filed off)
https://buttondown.com/jaffray/archive/thoughts-on-duckdbs-grammar-patching-thing/
#duckdb #parsers #grammar #compilers #programming #software #cs
Lossless syntax trees and resilient #parsers:
Say you have an incomplete source fragment, ie in #rustlang a let that has no RHS:
let a: Type =
and you want to wrap that arm of the syntax tree to indicate error.
Is it most helpful on the receiving side (such as when implementing LSP code or an interpreter) to have the resulting tree hierarchy as:
Statement > Error > MissingTerm
or
Error > Statement > MissingTerm
or
Statement > MissingTerm > Error
...where the Error is holding some context
#hacktoberfest (https://hacktoberfest.com/) is a great way to start in contributing to #OpenSource projects.
If you know #PHP and are interested in working on the topic of #parsers, these two projects welcome new contributors:
- https://github.com/MyIntervals/PHP-CSS-Parser/ a CSS parser
- https://github.com/MyIntervals/emogrifier a tool to inline CSS in HTML (mostly for emails)
(Boosts appreciated.)
🐻 Precedence-aware pretty printing
@basus you wanna read the Dragon Book
https://en.m.wikipedia.org/wiki/Compilers:_Principles,_Techniques,_and_Tools
#compilers #parsers #DragonBook
“Compilers For Free” [2013], Tom Stuart (https://tomstu.art/compilers-for-free).
#Interpreters #Compilers #Parsers #CompilerGenerators #Programming #FutamuraProjections #PartialEvaluation #Ruby #JavaScript
“LL And LR In Context: Why Parsing Tools Are Hard” [2013], Josh Haberman (https://blog.reverberate.org/2013/09/ll-and-lr-in-context-why-parsing-tools.html).
On Lobsters [2016]: https://lobste.rs/s/llaqr3/ll_lr_context_why_parsing_tools_are_hard
#Parsing #Parsers #Bison #CFG #Compilers #Grammars #ProgrammingLanguages #Syntax
The best explanation 👌🏽 of LL & LR #parsing techniques for non-theorists that I’ve seen so far:
“LL and LR Parsing Demystified” [2013], Josh Haberman (https://blog.reverberate.org/2013/07/ll-and-lr-parsing-demystified.html).
On HN [2016]: https://news.ycombinator.com/item?id=12552298
Exploiting #HTTP #Parsers Inconsistencies
https://rafa.hashnode.dev/exploiting-http-parsers-inconsistencies
Trying to implement a custom Markdown parser when you know next-to-nothing about parsers is surprisingly difficult. I know that there's all sorts of language parsing tools out there (like lex and yacc), and I'm sure people who know how to build a C compiler probably feel like Markdown is a walk in the park, but for your average guy who just wants something that lets a human type text that a computer can figure out, it's a bit much.
Part of me is considering trying to create a general-purpose format that is designed to be easily machine-readable and parseable even if you aren't a parser writing genius. Another part of me is considering learning how to do parsing "for real". Unsure which part is going to win right now.
“Pratt Parsers: Expression Parsing Made Easy” [2011], Robert Nystrom (https://journal.stuffwithstuff.com/2011/03/19/pratt-parsers-expression-parsing-made-easy/).
Via HN: https://news.ycombinator.com/item?id=39066465
On Lobsters: https://lobste.rs/s/n8xfz8/pratt_parsers_expression_parsing_made
We have released a new CppCon 2023 Video!
Applicative: The Forgotten C++ Functional Pattern – Ben Deane – CppCon 2023
https://youtu.be/KDn28TZdKb4
#cpp #DesignPatterns #ErrorHandling #Functions #Monads #Monoids #Parsers #Ranges #SoftwareDesign
We have released a new CppCon 2023 Video!
A Fast, Compliant JSON Pull Parser for Writing Robust Applications – by @foonathan
https://youtu.be/_GrHKyUYyRc
#API #BestPractices #Boost #cpp #cppBasics #ErrorHandling #HowTo #JavaScriptObjectNotationJSON #Libraries #Parsers #SoftwareDesign