Implementing operators
Operators are expressions that compute a value. Simple operators that compute their results via a few instructions on the underlying machine were covered in the preceding chapters. This section describes how to implement an operator that takes many steps. You can call these operators composite operators. In this case, the underlying generated code may perform calls to functions that run natively on the underlying machine.
It may be useful to compare implementing composite operators that are built into to the language, as we are discussing in this chapter, with the feature of operator overloading in some languages such as C++. Operator overloading allows composite operators to be implemented, usually for new user-defined types, as part of a program’s source code. The purpose of operator overloading is usually to enable arbitrary new user-defined types to use the same concise arithmetic notation enjoyed by primitive atomic types in a language. However...