I Wrote A Programming Language – While

Published on 2 October 2026 at 18:28

“While we wait for life, life passes”- Seneca.

 

 

I am developing a programming language, currently codenamed Goblin.

It is heavily focused on set theory and draws on ideas from graph databases, with a factory-oriented design.

The goal is to make it possible to build graph-database-style node-and-record structures, then adapt them to represent larger object structures, networked records, lists, graphs, and more.
I would hope this language sort of exists at an intersection of different languages and might be a bit of an experiment in design.

My original principle was that these capabilities should be expressible directly in Goblin—not merely through a function call that returns a list. This would allow developers to create novel ways of organising data, naturally produce indexes, and define data structures that do not exist in other languages.

I did not want to create bespoke functions or data structures; I wanted users to write code that defined the structure themselves, enabling more creative database design beyond simply defining fields to be indexed. I wanted the ability to write descriptions that order data and define indexes.

That proved more difficult than I first expected, which is why this section is called “While” rather than “Data Structures.”

 

I wrote a While loop in a query language, then I used it as a jumping-off point to explore folding the database up.

 

Order In Data Like Protein Folding Not Like Calling A Function

 

 

Conventional languages provide a set of data structures out of the box. In C or C++, you can rebuild them from more primitive constructs—direct bit-level control, structs, and pointers—but by then you are working close to the level of assembly language. Most languages instead say, “Here is a list and a set,” then debate whether an unordered map should be called a dictionary or a map. You build your objects from those pieces.

Goblin works differently. Everything is a series of nodes, with a query language for finding those nodes and a system for linking them into a network diagram that describes how records relate to one another. Rather than incurring the overhead of joins, Goblin creates a graph: related records may live in separate memory locations, but each record knows where its related data exists in memory. This makes access very fast.

The current limitation is that each relationship must be declared individually. It would be more useful to define rules for connecting two nodes, then allow a function to apply those rules and link the data automatically. In a sense, lists, trees, and maps are all forms of graphs—although maps are perhaps less obviously so, even if many use B-trees internally.

The limitation in SQL is that keys must be defined and uniqueness then protected, and then you have to do joins to link up data using those keys.

I liked the idea of you writing code that defines an order in which you move through the data; it could fold up data across the database in interesting ways. What I want is code that can build lists from graph nodes. By selecting an order and a processing strategy, you could create a structure that determines how data should be retrieved—recreating SQL-style scans and indexes while also supporting linked-list behaviour in Python or C++.

I also liked the idea of overlaying multiple lists, allowing relationships such as “go to the next highest date” or “go to the next highest income.” I took inspiration from biology, where a protein begins as a long chain of amino acids and moves down an energy slope, connecting at specific points where chemical bonds become stable. We often describe computing as complex, but beneath the surface, most systems are some form of list, tree, or network.

If you could write a function inspired by protein folding—one that follows an energy calculation to connect a dataset—you might achieve better performance. Currently, I create partitions for object-oriented groups and functions, with logical and table-based groupings that support behaviours such as full table scans. But you could also create relationship tracks: following them could behave like using indexes, or like folding a database so related data exists close together. I call this idea database origami.

 

 

Required functions to provide

 

 

I decided that, for this to work, I would need a few helper processes. I spent a long time thinking about how iterators process data and why query languages do not offer something similar.

I would need a while function that continually processes and reprocesses data until everything has been handled. At first, I thought this would be relatively straightforward: sort the data, pull out the top value, and recursively call the function to connect it to the next value. Then I realised there are several ways to build an iterator that moves through data one item at a time. At a minimum, it requires two objects when the data already exists as a sorted list, and three or four when it does not. This creates a chicken-and-egg problem. In many programming languages, the list object already exists, so iteration is rarely something you need to consider. Building it from scratch, however, requires a while process to test the object, a larger query to determine what comes next, and a third process to determine what to connect. Together, these allow the data to be traversed one item at a time, even when no iterator object already exists.

The goblinoid method works like this: it creates a while process that defines which data to examine, filters that data to identify the next node, and then connects it to the node that follows. In theory, this design pattern can be expanded to create a wide variety of custom node and edge data structures.

 

while {name=='alice' ! .next_alice} {name=='alice' ! .next_alice alias .max 1 connect next_alice {name=='alice' ! .next_alice alias .max 2}}

 

I realised I needed max and min functions that could move through the “energy values” by analogy. In other words, I needed to retrieve not only the next highest or lowest value, but any value at a specific position in that order. The .max and .min functions do this: the number that follows specifies the depth. For example, max 1 returns the highest value in the dataset, while max 2 returns the second-highest value.

The ! .next_alice condition removes data that already has the next_alice relationship. As a result, the remaining data is added to this list from the wider pool of records in the database. In SQL, you would typically search table A, then retrieve related data from table B and join the two. In Goblin, you can create a custom index that begins in table A and points directly to a value in table B. To retrieve the next record, you could call the next relationship again from the new record. This could support a range of web-development use cases and AI agents, allowing an AI to move between records as though following web hyperlinks, without needing to perform joins.

The initial setup for this web of links is still computationally comparable to building those joins. However, because the approach combines elements of indexing and joins—and can persist once built—I believe it is more flexible overall. Ideally, you build it correctly once, then write code to maintain the index as new records are inserted. I have not implemented that maintenance step yet.

 

A double linked list is probably more expected. A ~ command can then be used to move back and forth along the list. Should also look at a command to cycle X steps along such a path.

Binary trees probably should not be allowed to take existing data but add on new nodes alongside to represent the indexes to an existing state, then look at a value and split up to do 

1 read to check if me the value looking for, 1 read to check value see if > or < than value to determine if goes left or right which is another read and then a third read to transfer to the new location. Requires a factory that does this.

Map already supplied with global. Create a mapping location system that takes a set of data and links based on a variable, then orders by key or sub value.

I also added a simplified print that,t if you do not tell the language what data you are selecting, it just prints out data a bit like JSON.

I highlighted the inputs in yellow.

 

 

 

The ~ (tilde) command tells the system to navigate through this relationship. The original command creates a linked list from the data, with each record pointing to the next. The final record currently points to itself, so I may need to add cleanup logic to remove it or terminate the chain properly.

Alternatively, the MIN command could reverse the process. With additional cleanup code, you could create a continuous loop by connecting the final value back to the starting point.

This is more expressive than SQL. Rather than simply saying, “Hey, build me an index or a table,” you can create almost any structure you want—a little like protein folding or database origami.

 

 

Mistakes and bamboozle-ment

 

 

The INSERT and UPDATE commands now run correctly.

This part of the code took much longer than expected. Although the MAX and MIN functions look elegant, they must dynamically determine whether a value is a string, number, or date, then apply the appropriate alphabetical, numerical, or chronological ordering.

Along the way, I wrote a large portion of the other data-structure features I wanted, but I did not have time to test them all. The IF/ELSE functionality already exists, along with code that splits datasets into class groupings and calculates averages for each group—although that was not originally on the roadmap. There is also a skeleton for automated list creation, key-value searches, and more generalised subquery folding. However, none of these features has been tested thoroughly enough to discuss with confidence, and I have not yet considered how they fit into the larger language.

This while-pattern, which enables a kind of protein-folding-like database origami, is the only part I have fully tested and verified.

Some protections allow the same field names to be reused across different data types, such as dates and numbers. It may be worth building in an embedded semantic layer to handle this, which was part of the original design. However, I over-engineered that approach and removed it while fixing a bug. Therefore, it sort of exists in a bit of a state of limbo as a feature.

I may need to return to this loop later to tidy it up and improve its performance.

 

 

Conclusion

 

The while loop works by checking whether existing data meets a requirement. It then performs the work defined in the following subquery or calculation. If I remember correctly, the selected option determines whether that work runs in a fresh context or uses the current one. 

I plan to turn this into a reusable design pattern. If I can, I will also make it possible to import and copy existing patterns that support this kind of yield behaviour. 

I still have a lot to build before I have the full range of behaviours and data structures I want. I expect networks to be relatively straightforward, and adding B-trees—the structure used in SQL indexes—will complete the resemblance to database index folding. I like the idea of calling these capabilities “folding” features. I think I called the {}+{} features “subquery folding,” and I like the broader idea of folding everything into the database.

The pointer-based memory-management work I spent so much time getting right makes this possible. You can fold a database index into a series of pointers, and then fold the subqueries around those pointers. Folding as a service. It works because the link to the next item simply stores the next record's memory address; you do not need to access the database through a table and row. This makes it possible to build a large web-like structure and explore where it can lead. It feels like folding a database into a piece of origami, where all the data sits virtually together through the relationships created here.

Still,

loops and lists were probably the hardest parts. Next, I will fold in network and tree data structures. Hopefully, I can complete both within the next week or two.

Every language I know builds a list or table by creating it first and then adding items to it. This is the first one where I think you can create a list or table directly from existing data. That makes it easier to load a set of data and work out the database design, rather than first building a logical model and then implementing it. I still recommend that approach for the best results, but this provides more options. For example, once a database design is complete, you may realise it would be faster to create a dedicated process that joins scattered data into a new relationship model. This would let you do that. 

I also need something similar for the hello world processes, and it would be interesting to build different neurogenesis protocols in a similar few lines of code. Though I still have to address how you will do the ANN maths using these nodes. I have reserved one or two symbols to allow this to happen, but I am unsure how you would describe an ODE (Ordinary differential equation) elegantly and in Goblin yet. I need to get rid of designing all the elements of Goblin before moving experiments over, and ideally need all the basics: concurrency (so can run more than one experiment at a time) and hard disk management (so can store files and which envision much more like a SQL-ish back end, i.e. new language up front, old database management fundamentals hiding in the back end).

Got a new website or agent that wants data from 5 tables and needs lightning-fast access to all of them. I think Goblin could do that with a few lines of code. Then later, deleting that relationship is one line of code. I think that is much more interesting as a piece of technology.

Rating: 0 stars
0 votes

Add comment

Comments

There are no comments yet.