版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Programming Languages and Development Environment(程序设计语言和开发环境)http:/ Hongfei YanSchool of EECS, Peking University10/8/20082Outline Programming languages Development environment3EvolutionEvolution of computer languages4计算机语言的演化 机器语言 指令由0和1串组成, 程序可直接执行 符号语言 用符号表示不同的机器语言指令,必须被汇编(assembler)为机器语言 高级语言 从关
2、注计算机转移到关注问题本身. 用语句(statement)构造应用逻辑.通常不能直接执行, 要编译(compile)或解释(interpret)执行.5Computer language The term computer language includes a large variety of artificial languages used to communicate with computers. It is broader than the more commonly-used term programming language. Programming languages are
3、 a subset of computer languages. For example, HTML is a markup language and a computer language, but it is not traditionally considered a programming language. Machine code is a computer language. It can technically be used for programming, and has been (e.g. the original bootstrapper for Altair BAS
4、IC), though most would not consider it a programming language. 6Types of Computer Languages Programming languages are the primary means by which developers of computing systems instruct a machine to organize or manipulate information or control physical devices. Most software is written using one or
5、 more programming languages. Common examples include C, C+, Java, BASIC, assembly languages, and many others. Scripting languages are designed to control other software or to coordinate the actions of multiple software applications. Machine code a non human-readable binary computer language which co
6、rresponds to the available instructions for a microprocessor. 7What problem gave birth to programming languages? Before high level programming languages existed, computers were programmed one instruction at a time using binary or hex. a tedious job and a lot of errors. Obviously, this job did not at
7、tract many people, so there was a shortage of programmers. Expensive computers sat idle for long periods of time while software was being developed. Software often cost two to four times as much as the computer. This led to the development of assemblers and assembly languages. Programming became som
8、ewhat easier, but many users still wanted floating point numbers and array indexing. Since these capabilities were not supported in hardware, high level languages had to be developed to support them.8What Makes a Language Hot? Ease of use Language Features Performance Corporate Support Experienced P
9、rogrammers Legacy Code910Evolution of programming languages11PASCAL Pascal 语言是由著名瑞士计算机科学家 N. Wirth (1984年图灵奖得主)设计的一种语言,1968 年提出后被全世界广泛接受,成为一种对计算机科学技术发展有巨大影响的语言。 这个语言的名字是为了纪念历史上著名的数学家和计算学科的先驱 Blaise Pascal(帕斯卡)。 Pascal 语言把许多好的东西结合在一个很简练的语言里,被计算机教育界广泛采用。从七十年代末往后的很长一段时间里,Pascal 成为世界范围的计算机专业教学语言。 12Nikl
10、aus Wirth In 1984 he won the Turing Award for developing a sequence of innovative computer languages. Euler, Algol W, Pascal, Modula, Modula-2 and Oberon. His article Program Development by Stepwise Refinement, about the teaching of programming, is considered to be a classic text in software enginee
11、ring. In 1975 he wrote the book Algorithms + Data Structures = Programs, which gained wide recognition and is still useful today. 13ADAAda生活在十九世纪中叶,是著名诗人拜伦的女儿设计了巴贝奇分析机上解伯努利方程的一个程序,并证明当时的19世纪计算机狂人巴贝奇的分析器可以用于许多问题的求解。她甚至还建立了循环和子程序的概念。由于她在程序设计上的开创性工作,被称为世界上第一位程序员。Ada 语言开发的目的是作为新一代的美国军用程序设计语言(1983-1995),
12、作为所有与国防有关的程序和软件的统一语言标准。Ada语言自 1983 年作为标准提出后,虽由美国国防部大力推行,也受到各国军方的重视,但不像预想的那样成功,其中一个原因是它太复杂。 14C C programming language was devised by Bell Labs of AT & T as a system implementation language for the nascent Unix operating system. Contribution: Efficiency Casting Flexible array Library Good portabi
13、lity Ken Thompson (left) with Dennis Ritchie (right)15C语言 C 是由美国贝尔实验室的 Dennis Ritchie 在 1972 年设计开发的,开发目的是想成为一种编制“系统程序”的工具语言。 Retchie 等人首先用自己发明的 C 语言编写了 Unix 操作系统。以后 C 语言逐步发展成为开发系统软件的主要语言。 C 语言已成为最重要的软件系统开发语言,由此可见 C 语言在计算机领域地位之重要。 16SIMULA Although never widely used, SIMULA is historically important.
14、 Developed from 1964-67, SIMULA was designed as a language to aid in creating simulations. SIMULA I was introduced in 1964, its sole purpose was system simulation. Immediately after SIMULA I was finished, the designers decided to work on a new language which would contain many more features so that
15、it could be used for more general purpose areas. The result was SIMLUA 67. To help make simulation easier, SIMULA 67 introduced the concept of classes, including instancing and coroutine. This was the beginning of data abstraction. 17C+ C+ was designed to provide Simulas facilities for program organ
16、ization together with Cs efficiency and flexibility for systems programming. It was intended to deliver that to real projects. Contribution: One line comment Inline function Multiple inheritance Overloading operators and functions18C+语言C+ 是在 C 语言基础上发展出的一种“面向对象”语言。它是由 Bjarne Stroustrup 在美国贝尔实验室开发的(19
17、79)。C+ 是 C 语言的一个扩充, 修正了 C 的一些弱点和不足,使用起来更方便可靠; 以支持“面向对象面向对象”(Object-Oriented,简称为OO)的程序设计方法为基本目标,提供了一套支持面向对象程序设计的机制,如“类”(class)、“对象”(object)等等。面向对象的方法被认为是开发复杂软件系统的一种有效途径, OO 程序设计语言也已经被广泛接受。C+ 是目前使用最广泛的一种面向对象的程序设计语言。 19我们这门课程主要介绍我们这门课程主要介绍C+语言语言20Notations Programming languages A notation for describin
18、g algorithms(算法,即步骤) and data structure (数据结构,即数据或者是信息) Program A sentence of a programming language21Outline Programming languages Development environment 命令行开发环境 集成开发环境22The compilation system The programs that perform the four phases (preprocessor, compiler, assembler, and linker) are known colle
19、ctively as the compilation system. gcc o hello hello.c23Building a program24Program execution25Typical C+ Development Environment Edit Programmer writes program (and stores source code on disk) Preprocess Perform certain manipulations before compilation Compile Compiler translates C+ programs into m
20、achine languages Link Link object code with missing functions and data Execute Transfer executable image to memory Execute the program one instruction at a time26GNU程序设计工具集 独立开发工具:编辑、编译、调试等是单独的工具, 通常是命令行界面 编辑工具: vi 编译工具: g+ 调试工具: gdb27程序调试 通常情况下, 可执行文件中不包含对源程序的引用信息, 如变量名, 函数名, 行号等. g+提供了 -g 开关, 将源程序
21、的信息存放在目标文件和可执行文件的符号表中, 允许 调试器(debugger) gdb 跟踪程序的执行 当程序崩溃的时候, 检查程序崩溃前的状态 运行并调试 $ gdb program 28gdb常用命令29Hello, world! in C+1 / HelloWorld.cpp2 #include 3 using namespace std;45 int main()6 7 cout Hello, world!n;8 / cin.get();910 return 0;11 $g+ -g -Wall HelloWorld.cpp -o HelloWorld30References cs101
22、 course Q&A on Sept. 30, 2008http:/ MSYS tutorialhttp:/ Linux command tutorialhttp:/ 31CodeBlocks编程环境 - 基本概念 Project(工程):编写程序的工作是以Project为单位。在开始一个新程序时,要先建立一个Project,之后在程序编写过程中所有与这个程序有关的文件都会包含在这个Project中。 编制的程序可以有各种不同类型,编程环境为每种类型的程序准备了一个模版,用来生成程序的最初框架。在门课程里只介绍编写Console Application类型的程序。 这类程序的特点是:
23、程序运行中会打开一个类似于DOS操作系统的界面,所有键盘输入都是通过DOS界面进行的,而所有输出都是输出到DOS窗口中。 32Source File(源程序) 源程序是我们用高级程序设计语言书写的程序。 源程序必须经过编译连接变成可执行程序(机器代码)才能运行。 我们主要用C+语言编写源程序。 33Compile(编译) 把源程序变成机器目标代码的过程称为编译。不同的高级语言有不同的编译器。 各种高级语言都会提供一些常用的功能模块,我们自己编写的程序里会调用这些功能模块。 编译并连接是把源程序编译 如果没有错误则连接, 否则给出编译错误信息。Link(连接)Build(编译并连接)34Debug(调试) 当程序出错时,可用调试工具发现错处的代码,进行改正。 所谓调试是指逐条执行或部分执行程序代码,并在执行过程中查看变量的值。 当发现变量的值并非如我们预期或程序的执行逻辑并非我们预期时,就发现了错误,可以进行有针对性的改正。35Run(运行) 启动一个可执行程序使其开始执行称为运行。36CodeBlocks编程环境基本功能 创建新工程 编辑源程序 编译 / 连接 运行 调试 37CodeBlocks编程环境 - 创建新工程38CodeBlocks编程环境 - 创建新工程39Cod
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 医学心理学与临床人文融合模式
- 职业规划文章写作指南
- 招投标智库专家入库考试卷(C卷)-含答案解析(法规+实操)
- 虚拟行业职业规划
- 医学影像云与电子病历整合
- 二次根式 课件 2025-2026学年人教版数学八年级下册
- 医学影像AI模型的隐私保护与诊断效能优化
- 医学大数据摘要的海报可视化策略
- 浙江省宁波市“十校”2026届高一生物第二学期期末联考模拟试题含解析
- XX村防汛抗旱应急预案(2026年修订版)
- 手术室废物的管理课件
- 公安心理素质测试题及答案
- GB/T 31329-2025循环冷却水节水技术规范
- 广西普法考试试题及答案2025年
- 临床研究员项目风险评估与应对预案
- 矿业安全试题及答案
- 商铺买卖合同(标准版)
- 《金控集团全面风险管理手册》(2025年版)
- 环境材料概论课件第二章吸附材料
- 【新疆、西藏】2025年高考全国卷理综化学高考真题(原卷版)
- 《人工智能概论高职》全套教学课件
评论
0/150
提交评论