feat(operator): allow operator overloading for binary/unary/print op
Add support for operator overloading:
- Binary operator:
+ : add
- : sub
* : mul
/ : div
% : mod
&&: and
||: or
==: eq
!=: ne
< : lt
> : gt
<=: le
>=: ge
- Unary operator:
- : neg
! : not
- print function
Binary operator overloading:
- Try to find op and rop, if ambiguous then issue an error
Modify AST:
- Add member callExpr to some of the nodes to store operator function
Add errors:
- BinaryOperatorAmbiguousError:
Ambiguous candidates for binary operator
- BinaryOperatorNotFoundError
No method match the binary operator
- UnaryOperatorNotFoundError
No method match the unary operator
Showing
Please
register
or
sign in
to comment