Rethinking Pattern Matching: Flowcharts and PEG Parsing in a RISC-V C Compiler

Pattern matching is at the heart of compilers—but it’s often buried in complex, hard-to-read code.

What if we could make it visual—and declarative?

In this talk, we explore a new approach where flowcharts represent pattern matching logic as tree structures, inspired by logic programming. Instead of writing matching rules directly in code, they are defined visually and compiled into Rust.

LEVEL: Intermediate

Place
RustLab Deep Ocean
Length
45 min
When
November 2nd, 2026
16:45

Abstract

Pattern matching is at the heart of compilers—but it’s often buried in complex, hard-to-read code.

What if we could make it visual—and declarative?

In this talk, we explore a new approach where flowcharts represent pattern matching logic as tree structures, inspired by logic programming. Instead of writing matching rules directly in code, they are defined visually and compiled into Rust.

This approach is applied in a RISC-V C compiler, where flowcharts describe transformations and matching rules. Using Rust macros, a PEG parser (Pest), and the logic programming library Ascent, these diagrams are translated into efficient, type-safe implementations at compile time.

By combining visual structure with logic programming, this method enables more declarative and composable pattern matching, making compiler logic easier to read, modify, and reason about.

This session shows how Rust can go beyond implementation and help rethink pattern matching in compilers through diagrams, logic, and compile-time generation.

RustLab is a conference made by Develer.
Develer is a company based in Campi Bisenzio, near Florence. Our motto is : "Technology to give life to your products". We produce hardware and software to create exceptional products and to improve industrial processes and people's well being.
In Develer we have passion for the new technologies and we offer our clients effective solutions that are also efficient, simple and safe for the end users. We also believe in a friendly and welcoming environment where anybody can give their contribution. This passion and this vision are what we've been driven to organize our conference "made by developers for developers".

Subscribe to our newsletter

We hate spam just as much as you do, which is why we promise to only send you relevant communications. We respect your privacy and will never share your information with third parties.
©2026 RustLab | The international conference on Rust in Italy-Design & devCantiere Creativo-Made withDatoCMS