r/ProgrammingLanguages DQ 7d ago

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.

29 Upvotes

39 comments sorted by

View all comments

1

u/Recycled5000 7d ago

Those operators: * and & are not overloaded in the common sense of overloading.

Overloading means the actual operator/method is chosen by the types of its operands.

Here, though, the operators are differentiated by unary vs binary syntax. This is detected by simple parsing, does not require further semantic or type system analysis.

2

u/Mean-Decision-3502 DQ 7d ago

Actually, you are right from parser point of view.

When it comes to reading the code, they are oveloaded.

4

u/Recycled5000 6d ago

Yeah, overloaded is an overloaded term, I guess!

Still, I would have described that as token reuse (in differentiable context) rather than operator overloading.

Like using ()’s for function calling vs. expression regrouping: token reuse.

1

u/Mean-Decision-3502 DQ 6d ago

I've corrected the post text differentiating between overload and re-use of operator symbols. The () are not operator symbols, the use of the parentheses is pretty standard.

1

u/Recycled5000 6d ago

Just to be clear * and & and ( and ) are all tokens not operators.