January 2025 Rustacean meetup

January 2025 Rustacean meetup

Sanchayan Maity

Sanchayan Maity

@sanchayanmaity

Understanding Cranelift and PEG parsing

Submitted Jan 1, 2025

The agenda for this talk will be divided in three sections as follows:

  • Cranelift - I

Understanding the basics of a compiler architecture/frontend/backend design. We will cover Cranelift (https://cranelift.dev/) here and understand why it exists/importance to the compiler/Rust ecosystem.

  • PEG

We will take a brief detour to talk about and understand PEG parsers. (https://en.wikipedia.org/wiki/Parsing_expression_grammar). We will see how one can use PEG for parsing and then parse a simple language, Brainfuck (https://esolangs.org/wiki/Brainfuck). Rust crate (https://pest.rs/) will be used here.

  • Cranelift - II

Having used PEG parser to parse a toy language like Brainfuck, we will then use Cranelift to compile and run a Brainfuck program. In the process, we will see how one makes the transition from an Abstract Syntax Tree (AST) to compiled/object code.

While we will try to make the material as accessible as possible, some familiarity with the concept of compiled vs interpreted languages and parsers will be assumed.

Expected runtime: 90 minutes

Comments

{{ gettext('Login to leave a comment') }}

{{ gettext('Post a comment…') }}
{{ gettext('New comment') }}
{{ formTitle }}

{{ errorMsg }}

{{ gettext('No comments posted yet') }}

Hosted by

A community of Rust language contributors and end-users from Bangalore. We have presence on the following telegram channels https://t.me/RustIndia https://t.me/fpncr LinkedIn: https://www.linkedin.com/company/rust-india/ Twitter (not updated frequently): https://twitter.com/rustlangin more