Macro processor overview basic functions features machine independent design options. Macro processor designs are not directly related to the computer architecture on which. Write the macro processor in a programming language that allows. Macro definitions are typically located at the start of a program. A facility for writing macros may be provided as part of a software application or. Previous macro processor design cannot handle such kind of recursive macro invocation and expansion the procedure expand would be called recursively, thus the.
Macro processor design options recursive macro extension generalpurpose macro processors macro processing within language translators linebyline macro processor integrated macro processor 16 recursive macro expansion invocation of one macro by another it is not difficult if the macro processor is being written in a. Macro processor desiggpn options recursive macro expansion applying al ith f fi 4 5algorithm of fig. For every occurrence of macro the whole macro body or macro block of. The processing would proceed normally until line 50, which contains a statement invoking rdchar in addaddto,t eagu e t o t eo g a acoition, the argument from the original macro. Preprocess all the c source files specified and output the results to standard output or to the specified output file. It does not concern the meaning of the involved statements during macro expansion. The macro processor replaces each macro instruction with the corresponding group of source language statements expanding normally, it performs no analysis of the text it handles. It is easy to design a twopass macro processor in which all macro definitions are processed during the first pass. Gcc preprocessor options e run only the c preprocessor. Macros and macro processors macro computer science. A macro short for macroinstruction, from greek long in computer science is a rule or. A macro prototype statement one or more model statements macro preprocessor statements the macro prototype statement declares the name of a macro and the names and kinds of its parameters. Pdf a language independent macroprocessor researchgate. Macro processor design options recursive macro expansion figure 4.
737 216 1322 1321 697 590 175 633 903 532 1436 383 634 630 802 1479 1502 866 523 793 1245 1624 946 1614 965 639 1141 923 841 330 629 672 133 323 883 1483 537 794 1122 28 274 83 1218