当前位置:网站首页>编译型语言和解释型语言的区别
编译型语言和解释型语言的区别
2022-07-24 05:07:00 【ahyo】
计算机只能识别某些特定的二进制指令,在程序真正运行之前必须将源代码转换成二进制指令,所谓的二进制指令,也就是机器码,是 CPU 能够识别的硬件层面的“代码”。
究竟在什么时候将源代码转换成二进制指令呢?不同的编程语言有不同的规定:
有的编程语言要求必须提前将所有源代码一次性转换成二进制指令,也就是生成一个可执行程序(Windows 下的 .exe),比如C语言、C++、Golang、Pascal(Delphi)、汇编等,这种编程语言称为编译型语言,使用的转换工具称为编译器。
有的编程语言可以一边执行一边转换,需要哪些源代码就转换哪些源代码,不会生成可执行程序,比如 Python、JavaScript、PHP、Shell、MATLAB 等,这种编程语言称为解释型语言,使用的转换工具称为解释器。
简单理解,编译器就是一个“翻译工具”,类似于将中文翻译成英文、将英文翻译成俄文。但是,翻译源代码是一个复杂的过程,大致包括词法分析、语法分析、语义分析、性能优化、生成可执行文件等五个步骤,期间涉及到复杂的算法和硬件架构。解释器与此类似《编译原理》一书有更深的讲解。
Java 和 C# 则是半编译半解释型的语言,源代码需要先转换成一种中间文件(字节码文件),然后再将中间文件拿到虚拟机中执行。跨平台的同时兼顾执行效率。
编译型语言:
- 可执行程序不能跨平台
- 源代码不能跨平台
解释型语言:
相比于编译型语言,解释型语言几乎都能跨平台,“一次编写,到处运行”是真实存在的
边栏推荐
- Image to image translation with conditional advantageous networks paper notes
- Chapter 9 using image data
- Learning pyramid context encoder network for high quality image painting paper notes
- Jetson设备 faild to download repository information使用小技巧记录
- There is not enough space on the disk to complete this operation when partitioning the computer
- Print leap years between 1000 and 2000
- What if IPv4 has no internet access? Solutions to IPv4 without internet access rights (detailed explanation of pictures and texts)
- Solution to the prompt of online account opening and transfer in stock speculation that the depository and transfer services are not activated (China Merchants Bank)
- The difference between run and start in thread class
- Drools 开发决策表
猜你喜欢

Chapter 9 using image data

Recursive cascade network: medical image registration based on unsupervised learning

Ren Xudong, chief open source liaison officer of Huawei: deeply cultivate basic software open source and jointly build the root technology of the digital world

Post SQL era: edgedb 2.0 Release Notice

Chiitoitsu(期望dp)

Event extraction and documentation (2020-2021)

Xiaohongshu joins hands with HMS core to enjoy HD vision and grow grass for a better life

mapreduce概念

智能指针、左值引用右值引用、lambda表达式

一文带你深入浅出C字符串函数和内存函数
随机推荐
C primer plus learning notes - 5. Pointer
Image painting for irregular holes using partial revolutions paper notes
Learning pyramid context encoder network for high quality image painting paper notes
Learning pyramid context encoder network for high quality image painting paper notes
口叫SC 或者 pb 文件为读写控制ensor为
Support complex T4 file systems such as model group monitoring and real-time alarm. e
Transpose of array sparse matrix
This article takes you to understand C string functions and memory functions in simple terms
Summary of the development process and key and difficult points of the Listening Project
Uniapp learning
Why can't I log on my baidu account? Introduction to the solution of baidu account unable to log in
LabVIEW master VI freeze pending
Globally and locally consistent image completion paper notes
几种常见的排序
All sections need to be able to have a problem system port, the first subscript. Many machines become
Godson leader spits bitterness: we have the world's first performance CPU, but unfortunately no one uses it!
How to set up an internal wiki for your enterprise?
作、Ho量有关。嵌入,只有一70的该接
Memorandum 2022
后 SQL 时代降临:EdgeDB 2.0 发布会预告