z-logo
Premium
Implementing generalized operator overloading
Author(s) -
Miles William S.,
Johnson Leroy F.
Publication year - 1998
Publication title -
software: practice and experience
Language(s) - English
Resource type - Journals
SCImago Journal Rank - 0.437
H-Index - 70
eISSN - 1097-024X
pISSN - 0038-0644
DOI - 10.1002/(sici)1097-024x(199805)28:6<593::aid-spe161>3.0.co;2-s
Subject(s) - computer science , programming language , compiler , language primitive , programming language specification , specification language , very high level programming language , domain specific language , language construct , first generation programming language , programming language implementation , low level programming language , theoretical computer science , fifth generation programming language , programming domain , programming paradigm , symbolic programming , inductive programming
This paper presents a practical method of adding problem‐specific notation to an established computer language. Our idea is to use unrestricted operator overloading as a tool to map the problem domain notation directly into an existing programming language. Our method introduces new operator symbols and function names into a host language by overloading existing usage. We extend the host programming language syntax to an augmented language which is mapped to the host language by a programmable preprocessor. The preprocessor uses a programmer‐modifiable symbolic language grammar to translate an augmented program into a standard program. This process gives a natural extension to any computer language without modifying the host language. Direct use of problem notation can improve program legibility and code comprehension within the problem domain. The preprocessor provides a useful research tool for exploring language issues without the need to write a compiler for a new language. It can also be used to provide a domain specific language for a programming group at lower cost than new language development. This paper presents several working examples which illustrate our work. We redefine many of the standard C operators to alleviate some of the more common programming errors, thus creating a ‘cleaner’ C. As a more esoteric example, we encode a subset of APL vector operators as an algebraic extension to the C language. A curious application of our method shows its success in an arbitrary problem domain by compiling and executing poetry. Our final example introduces standard symbolic logic notation into C for tautology verification. © 1998 John Wiley & Sons, Ltd.

This content is not available in your region!

Continue researching here.

Having issues? You can contact us here