What is the state of the art for creating domain-specific languages (DSLs) with Rust?

This page summarizes the projects mentioned and recommended in the original post on /r/rust

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • pest

    The Elegant Parser (by pest-parser)

  • I second pest.rs. Using it is fairly intuitive and there's also a live playground on their website which is great for quickly developing and testing your AST (abstract syntax tree) parser for whatever language you're implementing.

  • egg

    egg is a flexible, high-performance e-graph library (by egraphs-good)

  • For semantic analyzers, check out egg and egglog. They're custom data structures for representing compiler rewrite rules in a non-destructive way.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • egglog

    egraphs + datalog!

  • For semantic analyzers, check out egg and egglog. They're custom data structures for representing compiler rewrite rules in a non-destructive way.

  • nom

    Rust parser combinator framework

  • As much as I love nom as well as other parser combinator libraries, regex-based parsers, BNF/EBNF-based parsers, etc. I always end up going back to plain old text-based char-by-char scanners.

  • lalrpop

    LR(1) parser generator for Rust

  • lalrpop

  • hyperscript

    Create HyperText with JavaScript.

  • In fairness, there's a lot of overlap between embedded DSLs and libraries — a library like Hyperscript for generating HTML in JavaScript is in many ways a DSL, but it's also just a bunch of functions that are easy to put together in a particular way. But this is often good enough!

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts