# I built a compiler for a controlled English-like mathematical language in Haskell — looking for compiler design feedback

> Source: <https://discourse.haskell.org/t/i-built-a-compiler-for-a-controlled-english-like-mathematical-language-in-haskell-looking-for-compiler-design-feedback/15066#post_3>
> Published: 2026-11-12 16:19:09+00:00

I’ve been developing **HumMac**, a compiler for a controlled, English-like mathematical language, using Haskell. (the final idea is to build towards a human-to-machine language compiler)

The project explores how a human-readable mathematical language can be given precise semantics and translated into a structured intermediate representation.

The compiler is organized around several components:

- 
A parser that constructs a structured abstract syntax tree
- 
A symbol table with explicit symbol identifiers
- 
Conversion from the source representation into Structured Mathematical IR (SMIR)
- 
Expression and proposition inference
- 
Numeric type promotion and semantic validation
- 
Definite-initialization analysis, including conditional branches
- 
Termination-analysis infrastructure

HumMac currently supports arithmetic expressions, implicit multiplication, bounded repetition, conditionals and six comparison operators. The compiler successfully parses this program, generates SMIR, constructs its symbol table and infers the types of its variables. Since it is currently a compiler rather than an execution environment, variables do not necessarily need to be initialized before they can be introduced or referenced. In particular, the language distinguishes free mathematical symbols, which can remain unassigned, from runtime variables, for which definite-initialization analysis is performed. This distinction allows mathematical expressions to contain symbolic variables without treating them as uninitialized runtime values.

One design distinction was separating free mathematical symbols from runtime variables. An unassigned mathematical symbol can represent a free variable in an expression, whereas a runtime variable may require definite-initialization analysis.

The project is still a prototype. SMIR generation and analysis are implemented, but a complete SMIR execution engine is not yet available.

**Implementation:** Haskell (GHC 9.10.3, Cabal)

**Repository:** [GitHub - RupsaMC/HumMac: A termination-verified controlled natural-language compiler implemented in Haskell. · GitHub](https://github.com/RupsaMC/HumMac)

I’d be glad to hear thoughts from the Haskell community, particularly on:

- 
The organization of compiler passes and intermediate representations
- 
Representing mathematical expressions and proposition in Haskell
- 
Semantic analysis and type inference architecture
- 
Approaches to making the implementation easier to extend as the language grows

This is my independent project and I’m sharing it in the hope of receiving useful technical feedback.

****** Why Haskell?***

*I chose Haskell partly because of my interest in the relationship between convergence and divergence in lambda calculus, and the way these ideas connect to the behaviour and evaluation of computational expressions. Haskell’s functional and strongly typed approach made it an interesting language in which to explore these ideas while building HumMac’s parser, intermediate representation and semantic analysis pipeline.*
