Preview

Single Pass Macroprocessor

Satisfactory Essays
Open Document
Open Document
488 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Single Pass Macroprocessor
Lecture notes of Single pass Macro processor dated 21.01.2013

Design of a single pass macro processor

I) Rule This design is based on the rule that all macro definitions should appear at the beginning of the program.

II) Format of defining a macro The format for defining a macro is as follows: MACRO (macro keyword …………………………….. (macro prototype

………………………………………. (start of macro body ………………………………………. ………………………………………. ………………………………………. (end of macro body

MEND (end of macro definition Example:

[pic]

Format of database of a single pass macro processor (Data structures used by a single pass macro processor)

A) Macro Name Table (MNT)
|Macro name |MDTP |#PP |#KP |KPTP |#EVS |
| | | | | | |

i) MNT is used for storing the macro names along with MDTP which indicates the location in MDT where the corresponding definition is stored. ii) MNT keeps track of the number of PPs and KPs for error handling. iii) MNT maintains a pointer to KPT called KPTP. iv) MNT also keeps track of the number of expansion variables required by the macro.

B) Macro Definition Table (MDT)
|Macro definition |
| |

i) MDT is used for storing the macro definitions along with MEND statement. ii) While storing the definition, the parameters and expansion variables are replaced by #n and EV#n respectively. iii) While performing macro expansion, #n and EV#n would be replaced by their values from APL and EVS respectively.

C) Keyword Parameter Table (KPT)
|Keyword

You May Also Find These Documents Helpful

  • Satisfactory Essays

    Rationale: The coder should refer to the CPT manual index and locate the main term "Insertion" then the…

    • 1386 Words
    • 7 Pages
    Satisfactory Essays
  • Good Essays

    Declares > this is the statements that declare variables, constants, and other code elements, which can then be used within that block…

    • 193 Words
    • 1 Page
    Good Essays
  • Satisfactory Essays

    Chapter 20 lab

    • 284 Words
    • 2 Pages

    4. What does dnl stand for in the m4 macro language; what are dnl commands used for?…

    • 284 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Nt1310 Unit 3 Quiz

    • 6337 Words
    • 26 Pages

    What is the primary purpose of the __P() macro? Choice 1 The __P() macro has no function, and merely obfuscates library function declarat ions. It should be removed from further releases of the C library. Choice 2 The __P() macro provides forward compatibility for C++ compilers, which do not r ecognize Standard C prototypes. Choice 3 Identifiers that begin with two underscores are reserved for C library implement ations. It is impossible to determine the purpose of the macro from the context given. Choice 4 The __P() macro provides backward compatibility for K&R C compilers, which do no t recognize Standard C prototypes. Choice 5 The __P() macro serves primarily to differentiate library functions from applica tion-specific functions. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /*question number 68*/ Which one of the following is NOT a valid identifier? Choice 1 __ident Choice 2 auto [Ans] Choice 3 bigNumber Choice 4 g42277 Choice 5 peaceful_in_space - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /*question number 69*/ /* Read an arbitrarily long string. */ Code: int read_long_string (const char ** const buf) { char * p = NULL; const char * fwd = NULL; size_t len = 0; assert(buf); do { p = realloc(p, len += 256); if (!p) return 0; if (!fwd) fwd = p; else fwd = strchr(p, '\0'); } while (fgets(fwd, 256, stdin)); *buf =…

    • 6337 Words
    • 26 Pages
    Good Essays
  • Good Essays

    In this phase a token is generated against all the lexemes in the source code. These lexemes and tokens are stored in the Symbol Table. Tokens against the lexemes are generated based on some patterns or rules.…

    • 703 Words
    • 3 Pages
    Good Essays
  • Good Essays

    This paper will describe the variable naming rules of three different programming languages. These three languages are Visual Basic, Python, and Java. Each of these languages has different rules that apply to them and some similarities. I will describe the rules and the similarities and differences in the next few paragraphs.…

    • 878 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    Macro – A pattern that instructs how an input sequence should be mapped to coincide with a replacement input sequence.…

    • 437 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Homework 6 Questions

    • 942 Words
    • 4 Pages

    Refer to the files, “Chapters 11 and 12 Notes” in Section 6 and your textbook Chapters 11 and 12 to help you answer the questions below.…

    • 942 Words
    • 4 Pages
    Good Essays
  • Better Essays

    2) The header is the starting point and the body is a list of statements that belong to the module.…

    • 1580 Words
    • 11 Pages
    Better Essays
  • Satisfactory Essays

    cmis 102 HW 2

    • 748 Words
    • 6 Pages

    In this program, I will be using various variables with different definitions. The table below will list and identify the variables:…

    • 748 Words
    • 6 Pages
    Satisfactory Essays
  • Satisfactory Essays

    3. In the forward() command, what does the number argument inside the parentheses do? (1.0 points)…

    • 290 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    AP Psych

    • 629 Words
    • 3 Pages

    6.5 What are the various types of LTM, and how is information stored in LTM organized?…

    • 629 Words
    • 3 Pages
    Good Essays
  • Better Essays

    ii. The first component of the class definition is called the access_mode. It will either be public, abstract, final, or not used at all.…

    • 939 Words
    • 4 Pages
    Better Essays
  • Satisfactory Essays

    The expression 1 To 5 in the Case 1 To 5 clause specifies the range of numbers from ____.…

    • 595 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    Medical Coding

    • 450 Words
    • 2 Pages

    I. The first step in coding is to locate the main term in the Alphabetic Index.…

    • 450 Words
    • 2 Pages
    Good Essays