当前位置:网站首页>Soft test --- fundamentals of programming language (Part 1)
Soft test --- fundamentals of programming language (Part 1)
2022-07-24 02:42:00 【Caterpillars who want to write programs】
One 、 Low level language and high level language
Low level language :
Machine language and assembly language are called low-level languages ;
Machine language refers to 0、1 A sequence of machine instructions ;
Assembly language refers to the language that uses symbols to represent instructions ;
High-level language :
High level language is from the perspective of human logical thinking 、 Programming languages for various applications , It's a lot more abstract , It needs to be compiled into object code on a specific machine to execute . This kind of language is relatively easy to understand , It greatly improves the efficiency of program design ;
Two 、 Compilers and interpreters
2.1 Concept
Programs written in high-level language or assembly language are called Source program ;
Source program written in assembly language , We need a translator called assembler to translate it into the target program , And then we can execute ;
Source program written in high-level language , Its translation process is called compile Program ;
According to the execution order of the source program , A processing program that translates sentence by sentence and executes relevant functions immediately after translation , Call it explain Program ;
2.2 Procedure execution mode
Compile implementation :
There are two stages when a computer executes a high-level language using compilation :
(1) Compile phase , Translate the source program into the target program ;
(2) Operation phase , Execute the compiled object program ;
advantage : High execution efficiency 、 Small footprint ;
shortcoming : Poor compatibility ;
Explain to perform :
Every statement of the source program is executed as soon as it is interpreted ;
advantage : Can perform well 、 Fast development speed 、 It is convenient to communicate with users ;
shortcoming : Low efficiency ;
3、 ... and 、 Basic principle of compiling system
(1) working process
It is mainly divided into 6 Stages :
a. Lexical analysis ;
b. Syntax analysis ;
c. Semantic analysis ;
d. Intermediate code generation ;
e. Code optimization ;
f. Target code generation ;
(2) Lexical analysis
2.1 Concept
Input source program , Scan the strings that make up the source program 、 decompose , Recognize every word , And delete useless information , Report errors in the analysis process ;
The basic grammatical symbols of a programming language are divided into five categories :
keyword 、 identifier 、 Constant 、 Operator 、 Boundary symbol ;
The word symbols output by the lexical analyzer are generally expressed as the following quadratic elements :
( Word type , Attribute values of word symbols )
Describing lexical rules is often used : Normal form 、 Finite automaton ;
2.2 State transition diagram
The state transition diagram is Limited state Of Directed graph , Use a circle to indicate the node state , Between nodes, there are directed edges to represent the state transition , Markable characters on the facing edge , Indicates the state transition of the previous state after accepting a character ;
Function of state transition diagram :
Used to identify a certain string ;
Requirements of state transition diagram :
state ( That is node ) Limited number ;
At least one initial state , Several termination States ;
Each side is marked with characters ( It can also be an empty character );
The representation habit of status identifier :
The initial state is " ○ " Express ;
For non terminating status " ○ " Express ;
The jump between States is used "
" ( There is a directional side ) Express ;
For termination status " ◎ " Express ;
Read one more character with " * " Express ;

2.3 Normal expression
Normal expressions and normal sets ( Definition and operation )
State transition diagrams can be used to construct lexical analysis programs , But it belongs to informal description ;
Normal expression ( Abbreviation: normal form ) It is a formal representation of lexical analysis ;
The formal method refers to the method of describing the problem with a set of strictly prescribed symbol system ;
advantage : Clearer and more accurate ;
Normal expression concept :
α ∈ Σ , be α yes Σ A normal form on , The normal set it represents is { α } ;
An example of a regular to regular rule set :
α Normal form , The normal set of its transformation is L(α);
β Normal form , The normal set of its transformation is L(β);
( α | β ) Normal form , The normal set of its transformation is L(α) ∪ L(β);
( α • β ) Normal form , The normal set of its transformation is L(α)L(β);
( α )* Normal form , The normal set of its transformation is L(α)*;
among , " | " Read as " or "、" • " Read as " Connect "、" * " Read as " Closure "( Any number of self repeating connections );
边栏推荐
- [diary of supplementary questions] [2022 Niuke summer school 1] d-mocha and railgun
- 相关性(correlation)
- Backward quantum cryptography migration! NIST announces 12 Partners
- 关于缺少编程基础的朋友想转行 ABAP 开发岗提出的一些咨询问题和解答
- 22 -- range and of binary search tree
- 通用机环境下安全版单机数据库使用非root用户管理的解决方案
- 软考---程序设计语言基础(上)
- 【FPGA教程案例39】通信案例9——基于FPGA的交织-解交织数据传输
- Attack and defense world web practice area (view_source, get_post, robots)
- Understand the timing of loading classes into the JVM
猜你喜欢

Nirvana rebirth! Byte Daniel recommends a large distributed manual, and the Phoenix architecture makes you become a God in fire

Pyg uses messagepassing to build GCN to realize node classification

Doodle Icons - 一组免费商用的涂鸦风格图标库,可爱轻快又独特

动态规划-01背包问题

Chinese scientists have made new progress in high security quantum key distribution networks

Wechat applet setting background image does not display problem solution

Recorded on July 21, 2022

数据湖(十五):Spark与Iceberg整合写操作

Camper recruitment | AI youth with the world in mind, the United Nations needs your help for sustainable development!

UIE: 信息抽取的大一统模型
随机推荐
Audio processing based on time-frequency diagram matlab
【知识图谱】实践篇——基于医疗知识图谱的问答系统实践(Part2):图谱数据准备与导入
Zone d'entraînement Web d'attaque et de défense (View source, get Post, robots)
Share an API Gateway project based on ABP and yarp
Wallys/DR4019S/IPQ4019/11ABGN/802.11AC/high power
Detailed vector
Relational expression greater than > less than < congruence = = = Nan isnan() logical operator double sense exclamation point!! & |% +-- Short circuit calculation assignment expression shortcut operat
[diary of supplementary questions] [2022 Niuke summer school 1] i-chiitoitsu
JDBC tool class
【补题日记】[2022牛客暑期多校1]I-Chiitoitsu
Unscramble the category and application principle of robot vision
【FPGA教程案例39】通信案例9——基于FPGA的交织-解交织数据传输
Tutoriel sur l'utilisation de la ligne de temps unitaire
Leetcode 203. remove linked list elements (2022.07.22)
Custom log annotation, request fetching
Responsive pbootcms template decoration design website
Vscade connects to the server. The password is correct, but it has been unable to connect
(六)装饰器扩展之[email protected]使用原理
分享一个基于Abp 和Yarp 开发的API网关项目
Uie: unified model of information extraction