Skip to main content
Soares Chen
Creator of Context-Generic Programming
View all authors

Programming Extensible Data Types in Rust with CGP - Part 2: Modular Interpreters and Extensible Visitors

· 40 min read
Soares Chen
Creator of Context-Generic Programming
note

This post's code predates the current design of CGP. The interpreter it develops is documented as it is now in the expression pages of the Projects section, one page per context, and Extensible variants explains the current design of the feature.

This is the second part of the blog series on Programming Extensible Data Types in Rust with CGP. You can read the first part here.

In this second part of the series, we will explore the use of extensible variants, by examining how it can be used in an extensible visitor pattern to build a modular interpreter for a toy math expression language.

Programming Extensible Data Types in Rust with CGP - Part 1: Modular App Construction and Extensible Builders

· 37 min read
Soares Chen
Creator of Context-Generic Programming
note

This post's code predates the current design of CGP. Extensible records explains the current design of the feature, and the application builder this post develops is one of the cgp-examples crates in the Projects section.

I’m excited to announce the release of CGP v0.4.2, a major milestone that significantly expands the expressive power of generic programming in Rust. With this release, CGP introduces full support for extensible records and variants, unlocking a range of new capabilities for developers working with highly modular and reusable code.

Extensible records and variants allow developers to write code that operates on any struct containing specific fields or any enum containing specific variants, without needing their concrete definition. This makes it possible to write truly generic and flexible logic that is decoupled from rigid type definitions.

CGP v0.4.1 Release: new cgp-handler crate, improved preset macros, and more.

· 4 min read
Soares Chen
Creator of Context-Generic Programming

We are excited to announce the release of CGP v0.4.1! This release brings several new features, quality-of-life improvements for macro usages, and a new crate cgp-handler.

Here are some of the highlights:

  • New cgp-handler crate: Provides abstract interfaces for defining components with common method signatures.
  • cgp_preset! macro improvement: Now supports wrapping of Preset::Provider.
  • #[cgp_component] macro improvement: Now supports automated derivation of UseDelegate.
  • Improved Documentation: Added inline Rust documentation for common CGP constructs.

Hypershell: A Type-Level DSL for Shell-Scripting in Rust

· 84 min read
Soares Chen
Creator of Context-Generic Programming
note

This post describes Hypershell as it was when the post was published, and its code predates the current design. The Hypershell pages in the Projects section document it as it is now, with each example program walked through as a short tutorial.

I am thrilled to introduce Hypershell, a modular, type-level domain-specific language (DSL) for writing shell-script-like programs in Rust. Hypershell is powered by context-generic programming (CGP), which makes it possible for users to extend or modify both the language syntax and semantics.