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

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


  • 99 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 [email protected]



1.

  • PL/0

  • Lex & Yacc


PL/0

  • PascalCPascal

PL/0

pcode

PL/0

(PL/0)

( pcode)

pascal/C)

pcode

PL/0

pascal/C


PL/0

PL/0

PL/0

pcode

pcode


  • PL/XPL/X

  • PL/X


  • :111712298:0011:303

  • PL/X


  • (10%)

  • (20%)

    11.10

  • (70%)


2.


2.1

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


  • 100001000000


  • 40machine language

    C7 06 0000 0002

    IBM PCIntel 8x8620 0 0 01 6


  • (assembly language)

    MOV X, 2

    (X0 0 0 0)(assembler)


  • x = 2;


  • 19541957IBMJohn BackusFORTRAN

  • Noam ChomskyChomsky(grammar)


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


2.2


1.

  • (token)

  • 1)a:=10+c*20

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


2.


3.


  • P-CodeC-CodeU-Codebytecode


4.


5.



C

# include <stdio.h>

# include <stdlib.h>

# define MAX_LINES 75

Enum booleans (FALSE,TRUE);

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



  • 55

  • PL/0


  • BASIC

  • Javajava(javac)java(java)

  • PL/0


6.


7.


2.3






  • (one pass)()3 568





  • Login