r/ProgrammingLanguages • u/Mean-Decision-3502 DQ • Sep 03 '26
Unambiguous Operator Specification for Programming Languages
https://nvitya.github.io/pluops/As I changed recently the operators in my programming language I've created this specification:
https://nvitya.github.io/pluops/
I did not wanted to overload the operators like the C does with the / or Pascal does with theand/or/not. Neither re-use the operator symbols for some very different purpose, like C does with * and & so the code becomes more readable. I was orienting for existing solutions so this is what I came up with. The specification contains the symbol usages and operator precedence too.
If you are developing a new programming language, it would be nice to follow some standard, so at least the expressions would be portable between the languages.
I'm open for debates or suggestions.
View all comments
Show parent comment
1
u/Mean-Decision-3502 DQ Sep 05 '26 edited Sep 05 '26
Oh! I'm really thankful for this comment.
It seems to me that you are mainly C "user".
I grew up with Pascal. The
/behaviour or^for pointers and postfix dereference are well-working in Pascal.Many other languages use always float result for
/, including Python3, Nim, Crystal. In these languages:3 / 2 * 10 == 10 * 3 / 2.The always float result for
/works well if the compiler does not convert the float silently back to int, so you usually cannot make accidentally floating point divisions, where integers are expected. Very important here to separate the floating point division from integer division with different operators.But C behaves differently. You've learned that how to use it and probably accepted that for floating point the expressions sometimes need hinting. (Frequently by adding additional parentheses where many parentheses are used already.)
It is nice to hear that you would like better the postfix dereferencing in C too.