Specifications and Compiler Generator
. How to write specifications of the source language and the target machine?
- Language is broken into sub components like lexemes, structure, semantics etc.
- Each component can be specified separately.
For example, an identifier may be specified as
. A string of characters that has at least one alphabet
. starts with an alphabet followed by alphanumeric
. letter (letter|digit)*
- Similarly syntax and semantics can be described
. Can target machine be described using specifications?
There are ways to break down the source code into different components like lexemes, structure, semantics etc. Each component can be specified separately. The above example shows the way of recognizing identifiers for lexical analysis. Similarly there are rules for semantic as well as syntax analysis.
Can we have some specifications to describe the target machine?
|