Simon Willison’s Weblog

Subscribe

Items tagged parsing, python in 2023

Filters: Year: 2023 × parsing × python × Sorted by date

Lark parsing library JSON tutorial (via) A very convincing tutorial for a new-to-me parsing library for Python called Lark.

The tutorial covers building a full JSON parser from scratch, which ends up being just 19 lines of grammar definition code and 15 lines for the transformer to turn that tree into the final JSON.

It then gets into the details of optimization—the default Earley algorithm is quite slow, but swapping that out for a LALR parser (a one-line change) provides a 5x speedup for this particular example.

# 13th August 2023, 9:50 pm / compilers, json, parsing, python

Building Search DSLs with Django (via) Neat tutorial by Dan Lamanna: how to build a GitHub-style search feature—supporting modifiers like “is:open author:danlamanna”—using PyParsing and the Django ORM.

# 19th June 2023, 8:30 am / django, dsl, parsing, python, search

Types

Years

Months

Tags