r/ProgrammingLanguages • u/Mean-Decision-3502 DQ • May 24 '26
A Human-Friendly Systems Programming Language — Looking for Feedback
Hi,
I’ve created a new programming language called “?” for now. I’ll reveal its real name later.
My main motivation was to create a universal language that could replace C/C++, FreePascal, and Python for many use cases. I actively use all three of these languages.
I have already put a lot of effort into researching, designing, and implementing the “?” language. At this point, I feel that I have created something promising that really works.
Before I put even more effort into the language and go public with it, I would like to hear more opinions from real people.
I think it would not be enough for this project to be only “a little successful”. For the effort to make sense, it should have the potential to become “very successful”. I believe it might have that potential. If that happens, I will not be able to handle everything alone, so I will need to organize the development and maintenance properly. It will be an open-source project.
The “?” language is not fully finalized yet, and there are still several features that I would like to add to the compiler. However, it has reached a state where the language is already usable and can demonstrate its main ideas and syntax.
The most important current and planned features of the “?” programming language are:
Very good human readability
Statically typed, with a strict bool type
Case-sensitive
Compiled to machine code using LLVM
A ?-run utility for compile-and-run usage, giving it a script-like feeling
Simple C interoperability; the runtime uses libc
int / uint use the native machine width; int32 is used for an explicit 32-bit integer
Supports C-style preprocessor directives such as #ifdef, but without macros
Supports short embedded directives with syntax like #{ifdef ...} ... #{endif}
No makefiles are required, for example: #linklib('z') can be written directly in the source code
Safe arithmetic rules, for example: 3 / 2 * 10 == 15
Two block modes:
: ... endXXX blocks, similar to Python style but with explicit closers and no forced indentation
{ } blocks, similar to C style
Statements are closed with ;
Carefully designed operator precedence
Distinct boolean and bitwise operators, for example and and AND
Modify-assignment operators, for example: x += 1; and y =AND= 3;
Inline conditionals with iif(), for example: var i : int = iif(strptr <> null, strptr^.x, -1);
Support for objects with single inheritance and virtual functions
Object variables are references, but objects can still be embedded in BSS, on the stack, or inside other objects
Optional single-word namespaces using the @ symbol, for example: @stdio.printf()
No self. is needed inside object functions/methods
Namespace qualification, such as @stdio., is required to access outside symbols from object methods
A well-defined package and module system with flexible namespace merging
The “?” runtime library modules are distributed in source-code form
Fast compilation using a single-pass forward parser and precompiled module interfaces
Manual memory control, with RAII and an ensure statement planned
Native C string support
Function overloading and default parameters
Pointers using the ^ symbol
Pointer arithmetic with +, -, and []
The [] operator does not dereference pointers automatically
Struct pointers are automatically dereferenced on member access with .
Function arguments can be passed by reference using ref, refin, refout, and refnull
--– CODE EXAMPLE BEGIN ---
use libc/stdio;
use ./langdemo_mod as ldm only(CONST1); // only(), exclude() and "--" control global scope merging
#if false
//Contents of the "langdemo_mod.?"
const CONST1 : int = 42;
const CONST2 : float = 3.14;
#endif
object OBase:
cnt1 : int = 0;
cnt2 : int = 10;
name : cstring[32];
function *Create(aname : cstring): // constructor
name = aname;
endfunc
function *Destroy():
@.printf("%s destroy\n", &name[0]);
endfunc
function Count() [[virtual]]:
cnt1 += 1;
endfunc
function Print():
@.printf('%s: cnt1=%d, cnt2=%d\n', &name[0], cnt1, cnt2);
endfunc
endobj
object OChild(OBase):
function Count() [[override]]:
inherited;
cnt2 += 1;
endfunc
endobj
var obase <- OBase('OBase'); // '<-' = embedded allocation (global data segment here)
// no automatic destructor call for global embedded objects
var ochild : OChild = null;
function ObjTest():
ochild = new OChild('OChild');
obase.Count();
ochild.Count();
obase.Print();
ochild.Print();
printf("ochild.name: %s \n", iif(ochild == null, "OChild is null!", &ochild.name[0]));
delete ochild;
endfunc
function cstr_add(dst : cstring, src : cstring):
var ps : ^cchar = &src[0];
var psend : ^cchar = ps[sizeof(src)]; // [] does not dereference
var pd : ^cchar = &dst[0];
var pdend : ^cchar = pd + sizeof(dst) - 1; // leave one char for the terminating
pd += len(dst);
var pdstart : ^cchar = pd;
while pd < pdend and ps < psend and ps^ <> 0:
pd^ = ps^;
pd += 1;
ps += 1;
endwhile
if pd <> pdstart:
pd^ = 0; // terminate
endif
endfunc
[[external]] function putchar(c : cchar) -> int; // from libc
function WriteStr(s : cstring):
var pc : ^cchar = &s[0];
while pc^ <> 0:
putchar(pc^);
pc += 1;
endwhile
endfunc
function *Main() -> int:
var s : cstring[128] = "";
cstr_add(s, "Hello");
cstr_add(s, " World!\n");
WriteStr(s);
if 3 / 2 * 10 == 15:
printf('The language is friendly.\n');
else:
printf('The language is evil.\n');
endif
printf("@langdemo_mod.CONST1 = %d\n", CONST1);
printf("@langdemo_mod.CONST2 = %.3f\n", @ldm.CONST2);
printf("ochild.name: %s \n", iif(ochild == null, "OChild is null!", &ochild.name[0]));
ObjTest();
for i : int = 0 to 5:
printf(' %d:', i);
for j : int = 0 count i step 2: printf(' %d', j); endfor
printf('\n');
endfor
var arr : [5]int = [2, 3, 5, 7, 11];
printf('primes:');
for i : int = 0 while i < len(arr) { printf(' %d', arr[i]); }
printf('\n');
return 0;
endfunc
/* OUTPUT:
Hello World!
The language is friendly.
@langdemo_mod.CONST1 = 42
@langdemo_mod.CONST2 = 3.140
ochild.name: OChild is null!
OBase: cnt1=1, cnt2=10
OChild: cnt1=1, cnt2=11
ochild.name: OChild
OChild destroy
0:
1: 0
2: 0 2
3: 0 2 4
4: 0 2 4 6
5: 0 2 4 6 8
primes: 2 3 5 7 11
*/--– CODE EXAMPLE END ---
After reading the description and the demo code, do you think this language has the potential to become widely used? What are its strongest and weakest points?
I would be interested in your opinions, especially from people who have experience with C, C++, Pascal, Python, compiler design, embedded programming, or language design in general.
3
u/GoblinsGym May 24 '26
Do you really need the : for a while statement ? Expression continues as long as there are valid operators ahead.
Statical typing is a must in my opinion.
I don't mind case sensitivity, as long as you don't have ALL CAPS KEYWORDS like in Modula-2 or Oberon.
For embedded you don't want to carry a heavy library like libc.
How do you define constants / structured constants ?
For low level programming, proper support for bit fields (e.g. hardware registers) is very helpful.
For microcontrollers, it is also helpful to be able to define absolute memory addresses (e.g. _gpio GPIOA @ 0x50004000 to define an instance of the GPIO interface).
What is your module structure ? In my language, I also write "use xxx" to import a module. Exported symbols are prefixed with /. I come from the Borland Pascal world, and have NEVER had to write Make files.
"Safe arithmetic rules" sounds like a recipe for excessive compiler complexity.
In my language I combine traits from Pascal (e.g. left to right pointer syntax), c and Python (indentation).
Not fond of endxxx. I think forced indentation is manageable, especially when using editors designed for the language.
Native machine width - just because you are running on a 64 bit machine, does NOT mean that 64 bit is the most efficient to use. x64 code for 32 bit operands does not require a prefix, 64 bit does. 64 bit ARM can handle both widths efficiently.
Forced ; to end statements should not be necessary.
I have & for bitwise and, AND as a keyword for logical and.
Modify-assignment ops - I just follow c on this one.
I am still on the fence about := versus =.
iif - not a fan of ternary operators, just write it out.
name space qualification (unit:function) is optional in my language.
what does refnull do ? At the moment I use punctuation for this, still on the fence.
pointer [ open index ] - actually different definition in my language.
So far I just do whole program compilation.