当前位置:网站首页>编译型语言和解释型语言的区别
编译型语言和解释型语言的区别
2022-07-24 05:07:00 【ahyo】
计算机只能识别某些特定的二进制指令,在程序真正运行之前必须将源代码转换成二进制指令,所谓的二进制指令,也就是机器码,是 CPU 能够识别的硬件层面的“代码”。
究竟在什么时候将源代码转换成二进制指令呢?不同的编程语言有不同的规定:
有的编程语言要求必须提前将所有源代码一次性转换成二进制指令,也就是生成一个可执行程序(Windows 下的 .exe),比如C语言、C++、Golang、Pascal(Delphi)、汇编等,这种编程语言称为编译型语言,使用的转换工具称为编译器。
有的编程语言可以一边执行一边转换,需要哪些源代码就转换哪些源代码,不会生成可执行程序,比如 Python、JavaScript、PHP、Shell、MATLAB 等,这种编程语言称为解释型语言,使用的转换工具称为解释器。
简单理解,编译器就是一个“翻译工具”,类似于将中文翻译成英文、将英文翻译成俄文。但是,翻译源代码是一个复杂的过程,大致包括词法分析、语法分析、语义分析、性能优化、生成可执行文件等五个步骤,期间涉及到复杂的算法和硬件架构。解释器与此类似《编译原理》一书有更深的讲解。
Java 和 C# 则是半编译半解释型的语言,源代码需要先转换成一种中间文件(字节码文件),然后再将中间文件拿到虚拟机中执行。跨平台的同时兼顾执行效率。
编译型语言:
- 可执行程序不能跨平台
- 源代码不能跨平台
解释型语言:
相比于编译型语言,解释型语言几乎都能跨平台,“一次编写,到处运行”是真实存在的
边栏推荐
- Web3 product manager's Guide: how to face the encryption world
- Drools 开发决策表
- Problems and solutions of QT (online installation package) crash in win10 installation
- 招聘| 嵌入式軟件(单片机)工程师
- Hcde city closed door meeting successfully held in Nanjing station
- PSO and mfpso
- 口叫SC 或者 pb 文件为读写控制ensor为
- Emqx simple to use
- HCIA NAT experiment
- 微信朋友圈的高性能架构设计
猜你喜欢

Yolov7 -- brief introduction of the paper

MapReduce concept
![[postgraduate entrance examination vocabulary training camp] day 10 - capital, expand, force, adapt, depand](/img/9a/a218c46806cf286f0518a72809e084.png)
[postgraduate entrance examination vocabulary training camp] day 10 - capital, expand, force, adapt, depand

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

一文带你深入浅出C字符串函数和内存函数

排序——QuickSort

Context encoders: feature learning by painting paper notes

Smart pointer, lvalue reference, lvalue reference, lambda expression

后 SQL 时代降临:EdgeDB 2.0 发布会预告

最大公约数
随机推荐
Jiang Xingqun, senior vice president of BOE: aiot technology enables enterprise IOT transformation
12306 the most wonderful verification code in history: normal users can easily identify the ticket grabbing software and are rejected
Icml2022 | rock: causal reasoning principle on common sense causality
GOM engine starts M2 prompt: [x-fkgom] has been loaded successfully. What should I do if it gets stuck?
[Huang ah code] Introduction to MySQL - 3. I use select *, and the boss directly rushed me home by train, but I still bought a station ticket
What if the computer can't take screenshots? The solution to the problem that the shortcut screen capture key of the computer cannot be used
Learning pyramid context encoder network for high quality image painting paper notes
Problems and solutions of QT (online installation package) crash in win10 installation
What does the red five pointed star in the lower right corner of sina Weibo avatar mean? How to become a master of sina Weibo?
智能指针、左值引用右值引用、lambda表达式
Post SQL era: edgedb 2.0 Release Notice
Illustration and text demonstrate the movable range of the applet movable view
Chapter V communication training
Recruitment | embedded software (MCU) Engineer
Threejs+shader drawing commonly used graphics
yum 查看某个命令由哪个安装包提供
Sword finger offer special assault edition day 7
Sort - quicksort
Unable to delete the file prompt the solution that the file cannot be deleted because the specified file cannot be found
项目普遍格式问题 src下添加 .eslinctrc.js