Building an expression language interpreter using Java 25's sealed interfaces, records, and pattern matching combined with functional optics from Higher-Kinded-J. The article demonstrates how to design an immutable Abstract Syntax Tree (AST) for parsing and evaluating expressions, generate lenses and prisms for type-safe

19m read time From blog.scottlogic.com
Post cover image
Table of contents
Article CodeThe Expression Language DomainDesigning the ASTGenerating Optics for the ASTBasic TransformationsWorking with the Sum TypeBuilding a Simple OptimiserSummaryWhat’s NextFurther Reading

Sort: