TL;DR
A programmer says a data structures assignment to evaluate a simple arithmetic expression led them to build graphLang, a functional programming language in C. Their report describes adding variables and functions, an arena allocator, closures, a garbage collector, a REPL and a foreign-function interface; the project’s performance and broader use are not established in the source.
A programmer says a binary-tree arithmetic assignment grew into graphLang, a functional programming language written in C with features including closures, garbage collection and a REPL. The account traces how a small evaluator prompted work on representing functions, storing variables and managing memory; it does not provide independent testing or evidence of wider adoption.
Get the latest gadgets delivered free with Prime
- Fast, free delivery on millions of items
- Prime Video, Amazon Music and more included
- Member-only deals all year
The original task was to evaluate 1 + 1 + 1 using a binary tree. The author first represented arithmetic operators as distinct expression types, such as addition and subtraction, then reconsidered that design: each operation accepted two expressions and produced another expression. In the report’s account, the evaluator did not need to know what each operation meant so long as it could apply a function. That led to an expression model with function application and values, later extended to include variables.
Implementing variables meant creating a hash table in C to look up names. The author then describes representing expression nodes as a tagged union with pointers, data and a type field. The report estimates that this structure occupies 32 bytes on a 64-bit system, before allocator overhead. It says individual calls to malloc() add 16 bytes of metadata on the author’s system, motivating a custom arena allocator that reserves a larger block and hands out nodes from it.
The project’s environment table was intended to hold both variables and functions. The author explains that native C function pointers could not represent user-written language functions as inspectable expression trees, or naturally serve as returned functions that could be evaluated later. The report says the project consequently grew to include closures and a garbage collector, along with a REPL and FFI. The supplied source excerpt ends partway through its explanation of function representation, so it does not establish implementation details for every feature.
From Expression Trees to Language Runtime
The development illustrates how a simple interpreter assignment can lead into the design of a language runtime. Choices about whether operations are special cases or general functions affect how a language handles user-defined functions; choices about how nodes are allocated affect memory use as the program builds expression trees.
For readers learning C or language implementation, the account connects abstract ideas—function application, variables and closures—to concrete engineering work such as hash tables, allocation and garbage collection. The report is a personal project account, however, and supplies no benchmarks or comparative measurements. Its memory estimates describe the author’s system and should not be treated as universal figures for all allocators.
Products Worth Considering

DJI Mini 5 Pro Fly More Combo Plus with DJI RC 2

Apple AirPods Pro 3 Wireless Earbuds with Active Noise Cancellation

Anker SOLIX C1000 Gen 2 Portable Power Station with 200W Solar Panel
As an affiliate, we earn on qualifying purchases.
The Assignment That Started graphLang
The report opens with a data structures problem: evaluate a chain of additions by turning it into a binary tree. In the example, the evaluator first reduces the inner addition in a left-associated expression, then applies the outer addition. This basic process requires the evaluator to identify and perform each operator.
The author’s design shift was to model those operators by their shared shape: each takes two expressions and returns an expression. That reframing made function application central to evaluation. Variables then required a way to associate names with values, and the account describes adding a hash table before moving on to the language’s environment and memory management.
The blog’s table of contents also signals later sections on the allocator, garbage collector and what to expect in subsequent parts. The source provided here does not include the complete article or those later explanations, so the project’s full roadmap and current state cannot be verified from this material.
““I was given a data structures problem of converting an arithmetic expression into a binary tree. Naturally, I decided to build an evaluator.””
— The graphLang author
Project Status and Performance
The supplied account does not specify when the project began, whether graphLang is publicly released, or whether anyone beyond the author has used it. It also provides no benchmark results, memory comparisons after introducing the arena allocator, or independent review of the implementation.
The source excerpt cuts off during the discussion of how language-defined functions are represented. It therefore does not show the complete closure or garbage-collection design, the language’s syntax, or which parts of the announced feature set are finished and usable. Those details remain unconfirmed by the supplied material.
Further Parts and Runtime Details
The blog’s table of contents previews sections on upgrading the memory allocator, building the garbage collector and what to expect in future parts. The author’s account points toward further explanations of function representation and runtime memory management, but the supplied material gives no dates for those installments.
Readers seeking to assess graphLang as a working language would need the complete implementation details and access to the project or demonstrations. The report excerpt does not state when, or whether, those materials will be published.
Key Questions
What is graphLang?
It is the functional programming language in C that the author says grew from an assignment to evaluate arithmetic expressions represented as binary trees.
What features does the author say the project gained?
The report names closures, a garbage collector, a custom allocator, a REPL and an FFI. The supplied excerpt does not document the full implementation or confirm the status of each feature.
Why did the author build an arena allocator?
The author estimated that expression nodes were 32 bytes on a 64-bit system and that malloc metadata on their system added 16 bytes per allocation. An arena allocator reserves a larger block and allocates nodes within it, avoiding a separate allocation for every node.
Why were C function pointers not enough?
According to the author, C function pointers would make user-defined functions opaque to the evaluator. The language needed functions that could be represented in its expression graph and returned for later evaluation.
Is graphLang available or independently evaluated?
The supplied source does not say whether graphLang is publicly available, provide benchmarks or report independent evaluation. Its release status and performance remain unclear.
Source: hn
