Posts

Showing posts with the label pattern matching

Variant types and pattern matching in HLVM

The compiler development series of articles in The OCaml Journal have culminated in an example front-end compiler targetting HLVM that now supports variants and pattern matching in addition to previous features. These new language features have been implemented using only a few lines of code, bringing the front-end up to only 253 lines of OCaml code! This new functionality allows substantially more complicated ML-style programs to be written, including the following symbolic simplifier: # type expr = Int of int | Var of int | Add of expr * expr | M...