Egel Language v0.0.2

I wrote a little toy language you now can read an introduction to. I fully blame LtU for getting me interested in hacking around languages so don't laugh, it's embarrassing enough as it is. You can try a small Conway's Game of Life example on TIO.

Anyway, just a short heads up. It's a small language based on untyped eager combinatorial rewriting of a DAG in C++, which isn't too fast.

You're all invited to break the thing, I am at version 0.0.2 and I want to get rid of possible bugs so your expertise can matter.

Anyway, leave your comment here. Preferably, a nice one.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Doesn't look bad. You may

Doesn't look bad. You may want to give it a formal syntax and semantics, or at least to provide more explanations. E.g., when constants "combine", what is the type/kind of the result? Can "data" introduce only nullary constructors/constants? Is there a difference between multiple "data" and a single one with the union of their constants?

Oh right..

The formal syntax is that of an untyped lambda calculus with constants. Well, where the abstraction is a pattern-matching one. I didn't want to bore people with math in the introduction, it isn't written as an academic paper.

The type of composing terms is term. It's all untyped, I don't have a better answer than that.


Even without static types you still have some well-defined cases of how to construct (and thus deconstruct) values. I guess those are:
1. Constants
2. Compositions of values
For patterns it's probably the same plus variables:
0. Variables
1. Constants
2. Compositions of patterns
And to pattern-match a composition (value) you have to provide a composition (pattern) with the same number of components? Or do you have some kind of varargs pattern matching in mind?

You have to experiment a bit

The grammar for the LC is pretty straightforward and everything else follows from that. I never claimed it is unstructured.

You have to experiment a bit with the calculus to see how varargs can be implemented.

def sum = [ X Y -> sum (X+Y) | X -> X ]

"sum 1 2 3" roughly corresponds to

sum 1 2 3 = sum (1+2) 3 = sum (1+2+3) = 1+2+3 = 6

It's an exploitable feature which is a consequence of the reduction strategy.

atomic strings?

What can you do with strings other than exact match and print?

It's not documented very well, yet

Strings are Unicode objects roughly taken from libicu. I lifted the most common operations from them but you'll need to read the source code for now. (toUpper, charAt, etc..)

Apart from that I implemented pack/unpack primitives to convert from/to a list of codepoints.

It's all very rudimentary at the moment.