Review Notes on Compilation Principles of University of Electronic Science and Technology of China (1): Introduction

Table of contents

foreword

Highlights

Classification of languages

von Neumann architecture

The concept of binding

variable

virtual machine

program unit 

chapter summary


foreword

This review note is based on Mr. Zhang's classroom PPT, for my final review and reference for my classmates.


Highlights


Classification of languages

  • Imperative languages ​​(mandatory languages) : von Neumann
  • Functional Languages : Mathematical Functions
  • Logical Language : Quantitative Logic
  • Object Languages : Abstract Data Types

von Neumann architecture

Base

memory + controller + processor

features

  • Data/instructions are stored in binary form 
  • How Stored Procedures Work
  • program execution
  • The contents of the memory can be modified

Performance on imperative (coercive) languages

  • Variables: Storage units and their names are replaced by variable concepts, which can represent one or a group of units and can be modified
  • Assignment: the result of the calculation must be stored
  • Repetition: certain sequences of instructions must be repeated to complete complex calculations

The concept of binding

  • Attributes : properties that an entity has
  • Binding : the process of establishing a certain relationship between an object (or thing) and some attribute
  • Descriptor : a symbol, statement or table used to describe the attributes of an entity, that is, the image of an entity to an attribute
  • Binding time : the moment when an object (entity) is associated with one of its properties

  • Static binding : An attribute that can be determined at compile time is called a static attribute. If the binding is completed at compile time and does not change at runtime , it is called static binding
  • Dynamic binding : Any attribute that can be determined at runtime is called dynamic attribute. If the binding is completed at runtime , it is called dynamic binding

variable

A variable is an abstraction of one or several storage units, and an assignment statement is an abstraction for modifying the contents of a storage unit

In addition to the name, the variable has four attributes: scope, lifetime, value, type

variable scope

  • Refers to the program scope that can access the variable
  • Static scope binding: define variable scope according to the grammatical structure of the program
  • Dynamic scope binding: dynamically define variable scope according to the execution of the program

variable lifetime

  • Refers to the time interval in which a storage area is bound to a variable
  • Data Objects: Stores and the Values ​​It Holds
  • Assignment: the activity in which a variable acquires memory
  • Length: the number of storage units allocated by the variable

the value of the variable

  • Refers to the content of the variable corresponding to the memory area unit
  • Anonymous variables are accessed through pointers
  • Binding of a variable to its value is dynamic
  • Variable initialization: no initialization error/random value initialization/default value initialization (such as default value 0)

variable type

  • Refers to the class of values ​​associated with a variable and a description of the operations to be performed on those values 
  • Can be used to interpret the meaning of the contents (bit string) of the memory area bound by the variable
  • When a language is defined, a type name is usually bound to a value class and a set of operations
  • When a language is implemented, values ​​and operations are bound to some machine binary representation

Binding of variable types

  • Static binding: done with a declare statement
  • Dynamic binding: implicit description and dynamic changes at execution time

virtual machine

A virtual machine is a machine implemented by software.


program unit 

  • Program unit: an independent call unit during program execution (subroutine/subroutine/procedure/...)
  • Representation of a unit: A compile-time unit representation is the source program of the unit ; a runtime unit represents the whole of a code segment and active record, called a unit instance
  • Active record: the storage area for the information needed by the execution unit and the data objects bound to the unit's local variables
  • Non-local variables: A program unit can refer to variables that are not declared by this unit but declared by other units
  • Reference environment: local variables + non-local variables
  • Alias: Two variables in the reference environment of the same unit are bound to the same data object, and these variables are said to have an alias
  • Side effects: when an object bound to a non-local variable is modified, side effects will occur

Program units can be activated recursively, so there can be many instances of a unit, but the code segment is the same, the only difference is the active record


chapter summary

The content of this chapter is conceptual and belongs to the introduction. You only need to familiarize yourself with the concepts, and pay attention to the places marked in red and bold.

Guess you like

Origin blog.csdn.net/m0_59180666/article/details/130831158