r/Compilers • u/Relevant_Wedding_793 • 27d ago
A Hobby Language Design Called Cimplified!
Hello! I am a teenager and I have a language design which many of you may not like, but it's just a hobby language and isn't meant to be big like Rust or Python.
The language is called Cimplified. It is a full AOT compiled language using Cranelift as the backend code generator to emit native machine code directly (it is not a C/C++ wrapper or transpiler), but with a slight twist: it uses a strict block-structure syntax rather than C-based syntax.
Everything in this language must live inside a block, and nested blocks are explicitly not allowed.
The Core Concept: Block Garbage Collection
I designed this because I've always despised Java’s "Stop The World" (STW) concept. It feels fundamentally inefficient for certain tasks. To solve this, Cimplified uses a Block Garbage Collector which cleans up unused memory block-by-block. When a block finishes execution, its local memory is wiped instantly, preventing global stutters.
Unique Syntax Choices & Grammar Breakdown
I know this sounds a bit weird, but my variable declaration is explicitly structured around delimiters to make parsing straightforward. The grammar always follows a strict order of: Type = Variable name = Value;
Here are all the types available in Cimplified:
• String: Used for textual data (e.g., String = name = john;)
• Int32: 32-bit integer for standard whole numbers (e.g., Int32 = x = 12;)
• Int64: 64-bit integer for large whole numbers (e.g., Int64 = y = 2333;)
• Isit: My custom name for a boolean conditional check (e.g., Isit = nameisjohn = true;)
• Float: Standard floating-point number (e.g., Float = pi = 3.14;)
• Floating: High-precision floating-point number, equivalent to a double (e.g., Floating = pi = 3.14159265;)
Additionally, instead of using standard for or while keywords to make loops, I use the block structure itself as the loop. By default, the compiler labels blocks in order (Block1, Block2, etc.).
To loop, you point to a block label and tell it how many times to run:
Loop B=(Block1) = 10;
If Block1 contains a print statement, it will loop and execute that entire block 10 times.
Ok thats all for the explanation this the Code example and the Output of this Example :
// // is the comment line
Start Now! // Still deciding between 'Start Now!' or 'Start Main'
StartB // Starts a Block
print("Hello, World!")
String = name = john;
Int32 = x = 12;
Int64 = y = 2333;
Isit = nameisjohn = true; // this an Boolean
Float = pi = 3.14;
Floating = pi2 = 3.14159265; // generally called or f64 Double But i named it Floating
print(Name, John, x, y, nameisjohn, pi, pi2)
EndB // Ends a Block and Marks it as A Full Block
print(Name, John, x, y, nameisjohn, pi, pi2) // this would be rejected by the compiler
StartB
Loop B=(Block1) = 2;
EndB
End Now!And the Output will print this text 2 time!
Hello World!
john 12 2333 true 3.14 3.14159265
Hello World!
john 12 2333 true 3.14 3.14159265Thats All i want to Explain Of My Design Thank You for Reading this!
Also If You think this is A Great Idea Let me Know With a Feedback :)
5
u/AustinVelonaut 27d ago
Interesting idea about organizing things in blocks, but I think the implicit block numbering would get very tricky to reference with more than a few blocks. Have you considered something like named blocks, where blocks can be assigned to named variables? Then you could do something like:
Good luck on your project!
1
u/Relevant_Wedding_793 27d ago
hey SO Quick Update:
Theres an Human Error Which i forgot to add " " on john Like "john"
Sorry for the inconvenience :(
1
u/CubineGaming 22d ago
type = ident = val is very unintuitive as that would mean that the type is equal to the value or variable
for example, that would imply string is the same thing as name which is the same thing as “john”, which i sinply not true
1
u/Key_River7180 27d ago
Really cool! gl
-1
u/Active-Ad4328 27d ago
Bien, mais comment on fait des calculs ? et des conditions ? et des réassignations ?
Si on ne peut pas faire cela, le langage est inutilisable...
De plus ce n'est pas techniquement pratique d'écrire des boucles à l'extérieur du corps de la fonction, de plus tu donne deux fois StartB EndB, pourquoi il ne l'exécuterai pas 3 fois ?
Comment on sait quel est le point d'entrée du script ?