<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/building-your-dsl-compiler-in-python---mateusz-sok--ng9xuvgvm" -->

---
title: Building your DSL compiler in Python - Mateusz Sokół
description: [EuroPython 2026 - S3B on 2026-07-17] 🎤 *Building your DSL compiler in Python by Mateusz Sokół*   🔗...
canonical: https://daily.dev/posts/building-your-dsl-compiler-in-python---mateusz-sok--ng9xuvgvm
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Building your DSL compiler in Python - Mateusz Sokół | daily.dev
og:description: [EuroPython 2026 - S3B on 2026-07-17] 🎤 *Building your DSL compiler in Python by Mateusz Sokół*   🔗...
og:url: https://daily.dev/posts/building-your-dsl-compiler-in-python---mateusz-sok--ng9xuvgvm
og:image: https://api.daily.dev/og/posts/Ng9XuvGVM.png
og:image:alt: Building your DSL compiler in Python - Mateusz Sokół
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Building your DSL compiler in Python - Mateusz Sokół

**[EuroPython Conference](https://daily.dev/sources/europython)** · 29 min read · 0 upvotes · 0 comments

## Summary

[EuroPython 2026 - S3B on 2026-07-17]
🎤 *Building your DSL compiler in Python by Mateusz Sokół*  
🔗 https://ep2026.europython.eu/session/building-your-dsl-compiler-in-python 

📝 Abstract:
A multitude of Python libraries offer Just In Time (JIT) compilation capabilities for general purpose computations, such as JAX or Numba. But in certain cases these solutions might not be enough, thus we seek more specialized solutions that can include domain knowledge as well.

Compilers for Domain Specific Languages (DSL) allow us to incorporate additional information during compilation, possibly tied to a specific domain, such as sparse arrays computing.

In this talk I'm going to introduce [Finch](https://finch-tensor.org/) - language and a compiler for sparse and structured multidimensional arrays, which specializes its kernels for control flow and data structures. It supports common control flow (loops, if conditions, etc.) and a wide variety of data structures - dense, sparse list, triangles, coordinate, or symmetry. 

The ongoing effort to move Finch from the original Julia implementation to pure Python exposed us to new ways of using Python - as a language for implementing compilers.

In this talk I will present some key aspects of Python language and ecosystem which played a central role in making us productive in the last months during this undertaking:
- Defining IRs with dataclasses and utilizing Structural Pattern Matching for term rewriting,
- Using [Lark](https://lark-parser.readthedocs.io/en/stable/) for parsing custom languages into large IR structures,
- Expressing complex rewrite schemes with [rewrite-tools](https://pypi.org/project/rewrite-tools/).

The audience will learn our approach to designing the structure of a compiler, together with a few technical decisions made along the way.
I hope these insights will be useful for engineers and scientists coming from closely related fields and projects also involving compiling custom languages, such as probabilistic programming or hardware design.

---
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License: https://creativecommons.org/licenses/by-nc-sa/4.0/

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=G9es51_7HQQ>

---

Tags: [#python](https://daily.dev/tags/python), [#conference](https://daily.dev/tags/conference)

[View this post on daily.dev](https://daily.dev/posts/building-your-dsl-compiler-in-python---mateusz-sok--ng9xuvgvm)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Building your DSL compiler in Python - Mateusz Sokół","url":"https://daily.dev/posts/building-your-dsl-compiler-in-python---mateusz-sok--ng9xuvgvm","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/building-your-dsl-compiler-in-python---mateusz-sok--ng9xuvgvm"},"datePublished":"2026-08-19T10:14:19.554Z","dateModified":"2026-08-19T12:02:00.973Z","description":"[EuroPython 2026 - S3B on 2026-07-17]\n🎤 *Building your DSL compiler in Python by Mateusz Sokół*  \n🔗...","image":"https://i.ytimg.com/vi/G9es51_7HQQ/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/G9es51_7HQQ/sddefault.jpg","isAccessibleForFree":true,"articleSection":"EuroPython Conference","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"EuroPython Conference","logo":"https://media.daily.dev/image/upload/s--qu8RO-lH--/f_auto,q_auto/v1777800764/logos/europython?_a=BAMAMiWQ0","url":"https://daily.dev/sources/europython"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/building-your-dsl-compiler-in-python---mateusz-sok--ng9xuvgvm","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"python,conference","timeRequired":"PT29M","video":{"@type":"VideoObject","name":"Building your DSL compiler in Python - Mateusz Sokół","description":"[EuroPython 2026 - S3B on 2026-07-17]\n🎤 *Building your DSL compiler in Python by Mateusz Sokół*  \n🔗...","thumbnailUrl":"https://i.ytimg.com/vi/G9es51_7HQQ/sddefault.jpg","uploadDate":"2026-08-19T10:14:19.554Z","duration":"PT29M","url":"https://api.daily.dev/r/Ng9XuvGVM","embedUrl":"https://www.youtube.com/embed/G9es51_7HQQ"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"EuroPython Conference","item":"https://daily.dev/sources/europython"},{"@type":"ListItem","position":3,"name":"Building your DSL compiler in Python - Mateusz Sokół"}]}
```

