Implementation of programming language ldou@cs ecnu edu cn
This presentation is the property of its rightful owner.
Sponsored Links
1 / 39

编译原理实践 Implementation of programming language 窦亮 [email protected] PowerPoint PPT Presentation


  • 87 Views
  • Uploaded on
  • Presentation posted in: General

编译原理实践 Implementation of programming language 窦亮 [email protected] 序言. 《 编译原理 》 的课程实践一般有两种可能的安排。其一,为配合编译课程教学,而安排多次小型实践,分别支持编译程序的各个阶段。其二,针对某一规模适中的语言来设计和实现一个相对完整、独立的编译器。 《 编译原理实践 》 作为 《 编译原理 》 课程的延伸,目的是让大家动手设计和实现某一规模适中的语言的编译器,该编译器不仅涉及编译程序的各个阶段,而且也强调了编译的总体设计、各个阶段的接口安排等等。. 1. 课程目标.

Download Presentation

编译原理实践 Implementation of programming language 窦亮 [email protected]

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Implementation of programming language ldou@cs ecnu edu cn

Implementation of programming [email protected]


Implementation of programming language ldou cs ecnu


Implementation of programming language ldou cs ecnu

1.

  • PL/0

  • Lex & Yacc


Implementation of programming language ldou cs ecnu

PL/0

  • PascalCPascal

PL/0

pcode

PL/0

(PL/0)

( pcode)

pascal/C)

pcode

PL/0

pascal/C


Implementation of programming language ldou cs ecnu

PL/0

PL/0

PL/0

pcode

pcode


Implementation of programming language ldou cs ecnu

  • PL/XPL/X

  • PL/X


Implementation of programming language ldou cs ecnu

  • :111712298:0011:303

  • PL/X


Implementation of programming language ldou cs ecnu

  • (10%)

  • (20%)

    11.10

  • (70%)


Implementation of programming language ldou cs ecnu

2.


Implementation of programming language ldou cs ecnu

2.1

  • (source language)(target language)(high-level language)CC + +(object code)(machine code)


Implementation of programming language ldou cs ecnu

  • 100001000000


Implementation of programming language ldou cs ecnu

  • 40machine language

    C7 06 0000 0002

    IBM PCIntel 8x8620 0 0 01 6


Implementation of programming language ldou cs ecnu

  • (assembly language)

    MOV X, 2

    (X0 0 0 0)(assembler)


Implementation of programming language ldou cs ecnu

  • x = 2;


Implementation of programming language ldou cs ecnu

  • 19541957IBMJohn BackusFORTRAN

  • Noam ChomskyChomsky(grammar)


Implementation of programming language ldou cs ecnu

  • ( Chomsky hierarchy)---401232((context-free grammar))


Implementation of programming language ldou cs ecnu

2.2


Implementation of programming language ldou cs ecnu

1.

  • (token)

  • 1)a:=10+c*20

    2)while x>0 do x:=x-1


Implementation of programming language ldou cs ecnu

2.


Implementation of programming language ldou cs ecnu

3.


Implementation of programming language ldou cs ecnu

  • P-CodeC-CodeU-Codebytecode


Implementation of programming language ldou cs ecnu

4.


Implementation of programming language ldou cs ecnu

5.


Implementation of programming language ldou cs ecnu


Implementation of programming language ldou cs ecnu

C

# include <stdio.h>

# include <stdlib.h>

# define MAX_LINES 75

Enum booleans (FALSE,TRUE);

Main (int argc,char *argv[]*)


Implementation of programming language ldou cs ecnu


Implementation of programming language ldou cs ecnu

  • 55

  • PL/0


Implementation of programming language ldou cs ecnu

  • BASIC

  • Javajava(javac)java(java)

  • PL/0


Implementation of programming language ldou cs ecnu

6.


Implementation of programming language ldou cs ecnu

7.


Implementation of programming language ldou cs ecnu

2.3


Implementation of programming language ldou cs ecnu


Implementation of programming language ldou cs ecnu


Implementation of programming language ldou cs ecnu


Implementation of programming language ldou cs ecnu


Implementation of programming language ldou cs ecnu

  • (one pass)()3 568


Implementation of programming language ldou cs ecnu


Implementation of programming language ldou cs ecnu


Implementation of programming language ldou cs ecnu


  • Login