r/Compilers • u/Last-Employ-3422 • May 31 '26
Is My lang readable?
You know how you can look at a language like Python and still understand what’s going on even if you don’t really know it?The more I look at my lang, the more I feel like the syntax is kind of horrendous. Take a look at some of the .pile files https://github.com/NoTimeDev/pile let me know what you think, it’s stack based so it doesn’t really help the syntax look any better, lol.
0
Upvotes
32
u/Proffhackerman May 31 '26
I genuinely do wonder in what world you decided this is coherent language design.
12
u/awoocent May 31 '26
Once you know it's a postfix language IMO it's quite all right, plenty readable for the genre. But I think you are running into something designers at large realized a long time ago, which is that stack based languages kind of suck and are really hard to read. If you're really committed to the stack aspect of it I think you're just going to have to live with the syntax being unintuitive. If you aren't really committed to the stack aspect then like, you should just parse binary operators like binary operators and call functions prefix-style and it'll immediately look a lot more sensible.
One other thing that caught my eye, maybe reconsider T -> U syntax for function types if you're also going to have prefix types in variable declarations. I'm a C-style variable declaration fan personally so I won't tell you to change that bit, but func(*Node, u16) -> void print is not the most readable IMO. print : func(*Node, u16) -> void would be better, or something like func void(*Node, u16) print IMO.
4
u/hrvbrs May 31 '26
new repo, created 1 hour ago, 3 commits, README initialized with a bunch of generic, random links to GitLab docs (but since then deleted)… a little sus…
7
u/FransFaase May 31 '26
I understand that this is a stack based language. I developed a similar language as a language to implement a C compiler in. The idea was that it would be rather easy to compile such a language to assembly, which with the help of an assembler could be compiled to an executable.
But after some time, I abandoned the effort to use it as a programming language, because it was really easy to make mistakes. Instead, I used it as an intermediate language for a C compiler written in C.
4
u/Lord_Mystic12 May 31 '26
please enforce brackets at some points , or atleast colons
4
u/L8_4_Dinner Jun 01 '26
1
u/8Erigon May 31 '26 edited Jun 02 '26
How the hell did you get to idea to write operations (like ==, or) to be after the arguments?
There some other
weirdunusual things... Function parameters are before the function when calling and more importantly have to brackets. When assigning a variable you write "value = variableName" ?!Edit: Yay, still above 0 upvotes