General Information
Tutorials
Reference Manuals
Libraries
Translation Tasks
Tools
Administration
|
Oil Reference ManualDesign HintsSome `usual' problems in operator identification are presented with some suggested work-arounds using OIL(along with general guidelines for effective use of OIL.)Incremental Design and ImplementationIt is relatively easy to design and implement with OIL in incremental steps. One can work with the atomic/primitive types of your schema first and get the desired behavior with only identification. You can then add coercion sequence construction. And then work on the class specifications. Last of all one should work on compile time entity definition. These guide lines can be easily ignored but I would suggest that you find replacements for these rules rather than not do incremental design and implementation.
Identifying OperandsFor some problems it is easier to identify the operand types and associated coercion sequences independently of the operator. When using OIL to select addressing modes for assembly language this is often the case as the instruction set is factored into operation and operand address. Operations can be factored into classes which support different operand address mode signatures. The classes can be defined as an indication and the different patterns of address modes are the strongly typed data flow operators for the instruction.If we didn't use this method of `instruction classes' then we would have to duplicate the address mode patterns for each instruction in the class. This would be time consuming, redundant, and a strain on our name generation faculties. And such a multiplicity of names would cause its own confusion, reducing the benefit of using OIL.
Error HandlingThere are two ways to handle errors with OIL: use your own error type and use OIL's. Each has its own advantages.
OIL's error type is
If your own type is used(say
The error operator(
Modeling OIL's functionIf you need to model OIL in your compiler design, one of the most convenient ways is to consider the set of declarations which the OIL library manages as a database. This data base is initialized by the OIL specification and modified and accessed via the library functions.
Schema RestrictionsOIL has a very simple schema model. All of the library routines only add declarations to an OIL schema. There is no way to remove a declaration from an OIL schema once it has been added. This can have two impacts on your use of OIL. Every added declaration increases the cost of an identification which it may impact. Once an identification is added to the schema it may satisfy an identification request, the only way to prevent it is to control what kinds of requests are made.
Identification AlgorithmOIL has a two level search strategy: minimum cost identification and if costs are equal the most recent identification added to the schema.
|