Wednesday, 8 April 2015

Attribute Grammar - Compiler

Attribute grammar are formalisms that can be used for handling the context of long distance relations in a program that links to its declaration. For example: the use of variables.
Since attribute grammars are capable of describing the semantics of a grammar, their use can be extended to interpolation and code generation.





One can generate a program if he or she has a proper formalism in which to describe what a program should do using a program generator. For Example: Lexical analysis generated from grammars (syntax description) and code generators generated from machine descriptions.

Advantages of Generating Programs Rather than Writing by Hand:

1.   It is highly efficient and less prone to errors.
2.   The input of a program of a program generator is of a much higher level of attraction than the hand written can be.
3.   It is more flexible and can be easily modified.
4.   Pre - canned or tailored code can be added to the generated program, enhancing its power at a low cost.
5.   A formal description can be used to generate more than one type of a program.

No comments:

Post a Comment