Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What division operator symbol would you pick?

I am currently designing and implementing a small programming language as an extra-credit project in a class I'm taking. My problem is that the language has three numeric types: Long, Double, and Fraction. Fractions can be written in the language as proper or improper fractions (e.g. "2 1/3" or "1/2"). This fact leads to problems such as "2/3.5" (Long/Double) and "2/3"(Long/Long) not being handled correctly by the lexer.The best solution that I see is to change the division operator. So far, I think "\" is the best solution since "//" starts comments.

Would you pick "\", if you were designing the language?

Would you pick something else? If so, what?

Note: changing the way fractions are written is not possible.

Thanks in advance for your help,

-EDIT-

Current operators are:

** (power)

* (multiply)

% (modulus)

+ (add)

- (subtract and negation)

~ (reciprocal)

! (NOT)

> (greater)

< (less)

>= (greater-equal)

<= (less-equal)

== (equality)

<> (inequality)

& (AND)

| (OR)

^ (XOR)

?? (null-coalesing)

= (assignment)

Note: I am under no strictly binding demands by my teacher; however, I basically convinced him that I could turn a simple fraction calculator into a language. Changing the fraction's syntax would go against the fraction calculator's syntax for fractions, which is preferably avoided.

like image 917
Mackenzie Avatar asked Apr 29 '10 23:04

Mackenzie


2 Answers

The APL answer is ÷. I think that's recognizable.

like image 57
mpez0 Avatar answered Nov 04 '22 07:11

mpez0


How about a word "div"?

like image 6
Fyodor Soikin Avatar answered Nov 04 '22 07:11

Fyodor Soikin